Adding 401 user error to system.webServer.httpErrors gives the error "Could not start debugging on the web server"

I started with a simple MVC 3 web application. I created a new site in my local IIS for localhost: 80 and set up my new MVC 3 project to use this web server instead of the VS development web server. At this point, I can start and debug the project as usual. But if I add this to my web.config, I get the error message "Cannot start debugging on the web server." I can select start without debugging and it works great. What a deal?

<system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true" /> <httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="401"/> <error statusCode="401" responseMode="ExecuteURL" path="/Error401" /> </httpErrors> </system.webServer> 
+4
source share
2 answers

httpErrors is a new element that is used only by IIS7. This seems a little strange, however, try adding the following to the web configuration: system.web section :

 <customErrors mode="RemoteOnly" defaultRedirect="~/error"> <error statusCode="401" redirect="~/Error401" /> </customErrors> 
0
source

It is a pity that I can not give more hope here, but after extensive Internet research it seems that there is no permission. Whenever this node configuration is enabled, debugging does not start, even if there are no obvious errors outside of debugging.

Earlier, I noticed that problems with the certificate can lead to a similar error. Apparently, the debugger does not see what it expects, and as a result, it does not work.

My solution will include this directive only for our test environment and above, leaving it disabled for development.

0
source

Source: https://habr.com/ru/post/1383084/


All Articles