WebDev.Webserver – Unable to start debugging on the web server. The web server could not find the requested resource.
You may be unlucky enough to come across this error. If you do, I’ve not found any websites which explain the issue I’ve just spent the best part of a week sorting out. I still don’t know why , but I do know how to fix.
I was using a static port setup to make it easier to develop collaboratively, use bookmarks, not get confused etc. We did this by firstly adding an entry to Tools > External tools:
The program is: C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer40.EXE and this is the self-service, stand-alone Cassini server (.net4 edition) – the very same which Visual Studio launches when you hit F5 on a project.
We’ve set it up with the arguments: WebDev.WebServer /port:7070 /path:$(ProjectDir) /vpath:”/”
Then, in the Project Pages Window of the web project, we set the start page to http://localhost:7070 and the server to a custom server with a base URL of http://localhost:7070.
That way, you start the server via Tools > webserver then hit F5 which will build the site, attach to the Cassini instance on 7070 and debug.
That always used to work.
However, on a new virtual machine, for some reason, I kept getting this strange error when I tried to attach. Even if I ran the site without debugging, something wasn’t right. Very basic websites would be OK, but anything a little complicated, anything using the .NET stack, started giving really strange errors.
Nearly a week later, I’ve found a workaround. Basically, the way we’ve always been doing it could be a little better, because Visual Studio will let you define a static port number for the instances of Cassini which it spawns. So, go back to the project Property Pages and set everything back to how it was. Once you’ve done that (and you won’t see this bit until you do), click the project title in the Solution Explorer and press F4 for the Properties. Set Use dynamic ports to false, and set the Port number value to whatever you want.
For some reason, this works perfectly. I don’t know why. Normally I’d blame security or authentication, but I thought I’d ruled all of that out over the last couple of days.
Madness. Well, at least it works now.