Debugging ASP.NET MVC3 application hosted on Local IIS Webserver

asp.net, asp.net-mvc, azure, c#, iis

Solution

The issue was that since I had set up my IIS server to serve on port 83, while locally I would access on port 81, the debugger would not monitor those requests.

To solve this (or, generally, to debug remotely on the Cassini Web Server), download a tool called rinetd, which is a very simple traffic redirector daemon, and create a config.cfg in the folder where you extracted it to. The format is `<source ip> <source port> <dest. ip> <dest port>`. So, on my Mac, I go to this address in Safari: 192.168.1.23:8080/Controller/Action , and that is then redirected to localhost:81/Controller/Action , as if it was a local request! Here is the example config.cfg:

192.168.1.23 8080 127.0.0.1 81

Alternatively, you can use your PC name, to avoid having to assign a static IP or change the config when DHCP gives you a new address:

Jeff-PC 8080 127.0.0.1 81

Then, open a command prompt, and `cd` to your rinetd folder, and run `rinetd.exe -c config.cfg`.

Works like a charm.

Problem

I've managed to use the local IIS Webserver to host my MVC3 application, and I can debug it and everything, from the machine that is hosting it. - however, when I send a request from another machine (my Mac, which is running my Windows in a Parallels VM), I get the expected result, but the debugger wont stop at my breakpoints! I tried adding a `Debugger.Break();` to my action, and that crashes the w3wp.exe .. To, so summarize: Local requests are working, and can be debugged. External requests are working, but they cannot be debugged. In my project's properties, I set the `Use Local IIS Webserver`, `Use IIS Express` is unchecked. I'm using Visual Studio 2012 Professional. The project is Azure SDK-based, and the attached process is WaIISHost.exe.

Original source