Little Known ASP.NET Debugging Quirk Solved
I like to run Windows Server because IIS 6.0 allows me to add as many IP addresses as I want and configure completely separate web sites.
This is a big advantage with ASP.NET projects because now everything you do is relative to the real web site root (not the Virtual Directory root) and so you can expect exactly the same behavior in your app during development and debugging as you will when it is deployed to a real web site remotely.
The problem I've run into is that ASP.NET debugging doesn't always work. There are lots of reasons why ASP.NET debugging doesn't work, and there are lots of fixes, but this one is germane to the specific situation mentioned above:
If you have an ASP.NET app that is targeted to a specific web site root at a specific IP Address in IIS (not "all avalable" as is the default), you may need to modify both the .sln file and the .webinfo file to replace the site name with the actual IP address of the site. Then, ASP.NET debugging will work fine (provided you comply with the other 25 things you might still have wrong!).
Example:
.webinfo file:
<VisualStudioUNCWeb>
<Web URLPath = "http://192.168.0.110/MyWebSite.csproj" />
</VisualStudioUNCWeb>
.sln file:
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyWebSite", "http://192.168.0.110/MyWebSite.csproj", "{1EB1C062-1990-4483-AB4C-EA7854FE0E22}"
ProjectSection(ProjectDependencies) = postProject
Note that in both the above, the previous entries would have been "MyWebSite" and have been changed instead to the actual IP address the hosts file entry for it points to, or "192.168.0.110" in this case.
That does it!
This is a big advantage with ASP.NET projects because now everything you do is relative to the real web site root (not the Virtual Directory root) and so you can expect exactly the same behavior in your app during development and debugging as you will when it is deployed to a real web site remotely.
The problem I've run into is that ASP.NET debugging doesn't always work. There are lots of reasons why ASP.NET debugging doesn't work, and there are lots of fixes, but this one is germane to the specific situation mentioned above:
If you have an ASP.NET app that is targeted to a specific web site root at a specific IP Address in IIS (not "all avalable" as is the default), you may need to modify both the .sln file and the .webinfo file to replace the site name with the actual IP address of the site. Then, ASP.NET debugging will work fine (provided you comply with the other 25 things you might still have wrong!).
Example:
.webinfo file:
<VisualStudioUNCWeb>
<Web URLPath = "http://192.168.0.110/MyWebSite.csproj" />
</VisualStudioUNCWeb>
.sln file:
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyWebSite", "http://192.168.0.110/MyWebSite.csproj", "{1EB1C062-1990-4483-AB4C-EA7854FE0E22}"
ProjectSection(ProjectDependencies) = postProject
Note that in both the above, the previous entries would have been "MyWebSite" and have been changed instead to the actual IP address the hosts file entry for it points to, or "192.168.0.110" in this case.
That does it!
Comments
Post a Comment