13

I am running Visual Studio 2008, IIS 7.5 on Windows 7 x32. I am able to run the ASP.NET web site in IIS 7.5 without debugging just fine, but when I press F5 to debug it, I get:

Unable to start debugging on the web server. Unable to connect to the webserver. Verify that the web server is running and that incoming http requests are not blocked by a firewall..

Jamie Taylor
  • 4,709
  • 5
  • 44
  • 66
Rohit Khurana
  • 269
  • 3
  • 8
  • 18

7 Answers7

15

In VS, right click on your web project --> Properties Go to the Web tab.

Make sure the appropriate radio button is selected (Use VS Dev Server, Use Local IIS Web Server, etc)

After a computer freeze I've had that value change on me.

Another thing to try:

run "iisreset" from an administrative command prompt (basically just restarts the IIS service)

Rajat
  • 1,043
  • 12
  • 23
isopropanol
  • 445
  • 4
  • 10
  • "Make sure the appropriate radio button is selected" - this worked! I think is the first thing to check. – Lincoln Pires Jan 04 '16 at 12:39
  • What appropriate button... Make sure the appropriate radio button is selected.. this is vague.. – Ziggler Feb 24 '17 at 23:51
  • (Use VS Dev Server, Use Local IIS Web Server, etc) For whichever web server you want to start, that the app will run in. It's mid-way toward the bottom of the page. VS Dev Server used to be called IIS Express. – isopropanol Feb 28 '17 at 04:36
6

Check if your IIS is running, if isn't try to initialize him and run again on VS.

Lücks
  • 3,806
  • 2
  • 40
  • 54
  • I went to the Services control panel, and found my World Wide Web Publishing Service was not running. I hit "start" and was able to debug. – ALEXintlsos Nov 12 '15 at 20:57
  • In my case IIS was paused. Restarted and the error "unable to start debugging on the web server verify that the web server is running and incoming http request are not blocked by a firewall" went away – Akshay Anand Nov 16 '16 at 17:32
2

Try the following:

  1. Open IIS > Add a new Application (not a virtual folder) to the Default Website.
  2. Make sure the application runs under the right .net framework version (i.e. DefaultAppPool ussually runs under .Net 4.0)
  3. Map the application in IIS to the right project folder (where your bin and obj folder appear after a build)
  4. In IIS, right-click the application, and click 'Manage application' > 'Browse'. This will launch an internet exploreren to the right path. This could be localhost:80/Shop instead of the expected localhost/Shop (caused by for example a reservation for other applications of the direct localhost/ location)
  5. In Visual Studio > go to the application properties > Web > check Use local IIS > and set the correct location of your application in IIS (you should know this from step 4)
Santona
  • 31
  • 2
0

Verify that your web.config has the following entry:

<compilation debug="true" targetFramework="2.0" />

Note: If you are targeting framework 1.1, then obviously change the 2.0 to 1.1.

UPDATE:

The `targetFramework` attribute is new in .NET 4.0 and later, so to enable debugging on .NET 2.0 and earlier, then you cannot use the `targetFramework` attribute, like this:

<compilation debug="true" />
Karl Anderson
  • 34,606
  • 12
  • 65
  • 80
  • Ah sorry my fault, in .NET 4.0 they added the `targetFramework` attribute to the `compilation` element in `web.config`, just remove the `targetFramework="2.0"` attribute and value, answer updated. – Karl Anderson Aug 12 '13 at 13:35
0

Just to check: See if Windows Authentication is enabled or not? It should be enabled. Internet Information Services (IIS) Manager > Expand PC/Server Name > Expand Sites > Select Default Web Site > Select Authentication. It should be enabled.

Visual
  • 1
  • 1
0

Make sure that the port defined in the Project Url under the Web tab of the properties of the web project is the same one as defined in the IIS Manager.

I had this issue and fixing the port solved the problem for me.

Jonast92
  • 4,964
  • 1
  • 18
  • 32
0

I had a case, where I could load the site in chrome, but deugger could contact the server. Turns out Chrome auto-maps .localhost addresses, but VS does not.

Adding the localhost address to my hosts file solved the issue.

Stephan Møller
  • 1,247
  • 19
  • 39