22

I have set up project to be run on IIS for some time ago and when I did press F5 it did connect no problem. But recently this stopped working and I did get this error when I press F5 / press Debug->Start debugging:

Unable to start debugging on the web server. The remote server returned an error: (404) Not Found.

enter image description here

Here is my settings:

enter image description here

I am not sure what happened, probably some VS updates or Windows updates, but I've tried to google everywhere and nothing had worked. Attach to process works fine as before, but this simpler way stopped doing the trick.

Update:

Have tried Process Monitor to figure out what is going wrong and it looks like w3wp tries to access path MyProjectFolder\debugattach.aspx and the result is "NAME NOT FOUND". Don't know if this is the root of the problem though.

Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207
  • close visual studio and open the folder where your solution is. Try deleting the hidden folder named ,vs open visual studio and try debugging again – Ken Tucker Oct 31 '17 at 11:23
  • This did not help unfortunately – Ilya Chernomordik Oct 31 '17 at 11:51
  • Do you publish it to your IIS or just run it using IIS Express in project property, if you publish it, could you visit the page directly in your local browser? Can you run your app using "start without debugging(Ctrl+F5)"? Based on the 404 error, please make sure that the Application Pool is configured for the correct version of ASP.NET if you publish your app to IIS. – Jack Zhai Nov 01 '17 at 01:18
  • I do not publish the site, the path just points to the same location where the solution is.. Start without debugging works just fine, and the whole site works fine. I have read about the correct ASP.NET version, but that did not change in ages and I have double checked that it is set to 4. I use 4.5.2, but I doubt it should be a special choice for that? – Ilya Chernomordik Nov 01 '17 at 07:52
  • @Ilya Chernomordik, So it was the local web app, if so, could you share a screen shot about your project properties->Web? Do you select "IIS Express" as the server? Do you enable "ASP.NET" under Debuggers? – Jack Zhai Nov 02 '17 at 07:51
  • Yes, all that is set up correctly I think. I have added a screenshot. It also did run fine before. – Ilya Chernomordik Nov 02 '17 at 11:25
  • @Ilya Chernomordik, Not select "Local IIS", if you just select "IIS Express" in your project property, could you debug your app? At least, we could know that whether it is related to your app or the IIS configuration. – Jack Zhai Nov 03 '17 at 06:50
  • @Ilya Chernomordik, Please also remove your project from IIS manager, and then run your VS as the admin, click create virtual directory again in your project, debug your app, view the result. Or you could right click your project in IIS Manager-> Manager Application->Browser, view the result. See: https://msdn.microsoft.com/en-us/library/dwesw3ee.aspx?f=255&MSPPError=-2147217396 – Jack Zhai Nov 03 '17 at 08:43
  • 1. Tried IIS Express, looks like it runs fine there. It's very hard to know if debug actually works (hits breakpoints) because of setup, but at least it runs. 2. I have tried to delete the directory and clicked Create. It was created no problem, but the debug still gives the same message... – Ilya Chernomordik Nov 03 '17 at 13:01
  • I have done some research and updated post with debugattach that is not accessible. – Ilya Chernomordik Nov 03 '17 at 13:35
  • Thanks a lot for help I have found the reason now! Check my answer. You have pointed me to a good direction. – Ilya Chernomordik Nov 03 '17 at 13:47

9 Answers9

17

It appears that one of my colleagues has edited the web.config and added request filtering where he has removed the "DEBUG" verb. This disallowed debugging on F5. After adding it (or removing request filtering) everything works fine.

P.S. A lot of other possible problems with similar error is described here

Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207
  • Hi, I also have same issue, I have added the below setting in the web.config After this setting I am getting the above error, If I remove this then it's work fine? Does someone have any Idea why this is happening? or I need to allow any specific verbs to allow debugging? I would like to keep these settings and also want debugging to be enabled. – Ashish Shukla Apr 09 '18 at 06:09
  • You need to allow DEBUG verb – Ilya Chernomordik Apr 10 '18 at 09:39
  • 1
    Solution: http://coderjony.com/blogs/unable-to-start-debugging-on-the-web-server-the-remote-server-returned-an-error-404-not-found/ – Ankush Jain Sep 20 '18 at 19:09
  • 1
    @AshishShukla this is exactly what was causing my issue too, i moved that bock to the Web.Release.config so that it will end up in the config file when we deploy to PROD. Once I removed that section from the local web.config file i was finally able to debug against my local IIS instance – mknopf Aug 24 '19 at 04:43
9

Old post but I recently had this issue and making sure that the following settings were enabled in 'Programs and Features' (Windows 10) fixed the issue for me:

Programs and Features to enable

GeorgeB
  • 808
  • 1
  • 8
  • 26
8

In my case (Windows 10 & Visual Studio 2017) I had to install ASP.NET 3.5 and ASP.NET 4.7 under the Internet Information Services.

Click here to see the solution

Husam Ebish
  • 4,893
  • 2
  • 22
  • 38
1

This happened to me because I was using the Rewrite module to redirect to https. I was running https://localhost/WebSiteName, but had put my machine name in the https binding in IIS Mgr, Default web Site, Bindings. When I removed the machine name it worked.

  • 1
    This little nugget of wisdom saved my bacon. I hate the woeful obstructiveness of IIS configuration (actually I hate ALL Microsoft config complexity in all its forms). Instead I opted for the hack of commenting out the Rewrite module in web config. Site now works in debug mode. – Stuart Aitken Dec 03 '21 at 01:51
1

Recently I have faced the same issue in VS2013 Professional, instantly I get error 'Unable to start debugging on web server". I observed that whenever my current page is MVC view (.cshtml) file and I start debugging , the error window prompts every time. As switch the current document in my project to controller (.cs) file, and starts debugging, it works properly. So my workaround is to debug my code I have to be on (.cs) file not on (.cshtml / web.config) file. Hope that helps!

Garg V
  • 39
  • 5
0

Another reason for this problem is that you don't run visul studio Run as administrator.

mahmood kabi
  • 301
  • 1
  • 13
0

My issue was related 405 as attached below enter image description here

My issue got resolved after making my projects properties(Web and Build) as given below enter image description here

enter image description here

Rinoy Ashokan
  • 1,501
  • 17
  • 14
0

see this also HTTP Error 404.3-Not Found in IIS 10 as it helped me (HTTP Activation need to be enabled in Windows features)

Dinesh Rajan
  • 2,376
  • 23
  • 19
0

Im my case this error message (VS2017) was caused by the default http binding in IIS, port 80. Instead of being empty, "hostname" contained the name of my machine.

Solution: IIS-Default site-Bindings...- port http 80 - hostname make blank, or enter localhost

gharel
  • 413
  • 4
  • 13