sebastian
sebastian

Reputation: 897

IIS error, Unable to start debugging on the webserver

I want to run my application from IIS on my local machine. I created the virtual directory and added the application to it and in the properties folder of the application I checked the radio button 'Use Local IIS Webserver'. I then started running my application but I'm getting the following error:

Unable to start debugging on the webserver.see help for common configuration errors.Running the webpage outside of the debugger may provide further information.

Make sure the server in operating correctly.Verify there are no syntax errors in web.config by doing a debug.Start Without Debugging.You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation.

How do I get rid of this error?

I'm using Visual Studio 2010 on Windows 7 and IIS 7.5.

Upvotes: 80

Views: 195636

Answers (30)

dcarl661
dcarl661

Reputation: 322

Probably the most aggravating thing in web development.

Ok for me I use https and got sick of the invalid cert thing. So I created and installed a self signed cert called mysite.local. Then in sys32/drivers/etc/hosts I linked the machine ip (ipconfig) to mysite.local: 192.168.7.191 mysite.local.

but the ip address changed so i had to reset the hosts entry.

Upvotes: 0

Bonez024
Bonez024

Reputation: 1396

Don't ignore the obvious. A machine reboot did the trick for me.

Upvotes: 0

user15019772
user15019772

Reputation:

If you have tried 'iisreset', still it fails, then do the following steps :

iisreset

  • Open Command Prompt(Administrator)

  • C:\Windows\System32>ipconfig/flushdns

    ipconfig/flushdns

Upvotes: 0

Daniel
Daniel

Reputation: 2295

We've encountered this issue and found that it was due to RequestFiltering configuration in the web.config like below.

  <requestFiltering removeServerHeader="true">
    <requestLimits maxAllowedContentLength="30000000" />
    <verbs allowUnlisted="false">
      <add verb="HEAD" allowed="true" />
      <add verb="OPTIONS" allowed="false" />
      <add verb="GET" allowed="true" />
      <add verb="POST" allowed="true" />
      <add verb="TRACE" allowed="false" />
    </verbs>
  </requestFiltering>

After penetration testing, we had taken a strict approach and set allowUnlisted="false" and a number of non-standard HTTP verbs were not listed. While this is required in production, when needing to attach the debugger, we comment out this block:

  <requestFiltering removeServerHeader="true">
    <requestLimits maxAllowedContentLength="30000000" />
    <!--<verbs allowUnlisted="false">
      <add verb="HEAD" allowed="true" />
      <add verb="OPTIONS" allowed="false" />
      <add verb="GET" allowed="true" />
      <add verb="POST" allowed="true" />
      <add verb="TRACE" allowed="false" />
    </verbs>-->
  </requestFiltering>

Upvotes: 0

Iria
Iria

Reputation: 185

in my case change the debugging mode to external host fixed it

Upvotes: 0

Shaya
Shaya

Reputation: 2942

It could be a case of wrong windows user credentials.

This issue happens quite often after importing existing IIS projects that require a Windows username and password configured. To solve this, make sure both the Application pool app, the website, and the website's app are configured to work with your machine's credentials.

  1. On the IIS server node, select the pool-application/app/website and choose Advanced Settings.
  2. Check if the value of Physical Path Credentials is correct. Fix it if not.

enter image description here

  1. On the IIS server node, select the pool-application/app/website and choose Basic Settings.
  2. Click on "Test Settings" and validate that the credentials are correct.

enter image description here

Upvotes: 0

brianjlowry
brianjlowry

Reputation: 51

I tried everything on here and finally discovered that it was the setup in my web.config. I removed that section and it worked fine; I will go back and troubleshoot later as to why it was busted.

*Edit: I removed the statusCode="503" because of an issue with the App_Offline.htm file and the way in which the errors were configured. I've removed the line below (it isn't needed locally), and everything is working perfectly.

<remove statusCode="503"/>

Upvotes: 0

Nicolas
Nicolas

Reputation: 2376

Just to add in my 2 cents.

Recently I installed docker for another project and this was causing a project running on IIS Express to generate the error “The specified port is in use”. To solve this I did a few things, but namely I executed this command:

netsh http add iplisten ipaddress=::

This commands breaks down sites running on IIS Local, so if you executed this command you can make your IIS Local sites working again by executing the following which undoes the previous command:

netsh http delete iplisten ipaddress=::

Upvotes: 0

warlockdead
warlockdead

Reputation: 131

For who has same issue on VS Professional 2019. I Installed Xamarin bundle and after that this IIS error starts. I have tried all solutions above without any luck. What I did to fix it is :

  • From Visual Studio Installer check Development time IIS support from web & Cloud - ASP.NET and web development. enter image description here

  • Restart IIS

  • Open solution - Issue fixed.

Upvotes: 2

live-love
live-love

Reputation: 52484

Check the Physical Path.

In my case, I had changed it by mistake.

In IIS, click on your website, then go to Basic Settings...

Check the path, and check the credentials. Enter the new credentials if needed.

enter image description here

To change the path, you can go to Visual Studio, Project - Properties, and recreate the Virtual Directory:

enter image description here

If asked to remap, click Yes.

Upvotes: 4

Jonathan Applebaum
Jonathan Applebaum

Reputation: 5986

It always happens to me after my network password changes.
Open IIS >> choose the Application pool >> Advanced settings >> Application Pool Identity >> Set Credentials >> set username and the new password.

also:

  1. make sure the status of the application pool is "Started".
  2. Restart IIS, via IIS manager or open cmd as administrator and run the command iisreset.

enter image description here

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

Reputation: 172578

There may be many reasons for the above problem.

You need to check this:- Unable to Start Debugging on the Web Server

On a side note:- Go to IIS and check that the App Pool you are using is started.

Try this from your command line:-

cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i

Upvotes: 50

James
James

Reputation: 2009

Check your web config, if there are problems, you may get this error. I had a HTTP to HTTPS redirect in the web config but the application was set to launch as http.

To fix (Local IIS):

  1. Configure a https binding for your application in IIS.
  2. Right click the web project then Properties > Web. Under Servers, set the URL to your https URL.

Upvotes: 0

Mike
Mike

Reputation: 1876

Building on the answer from @MiscellaneousUser, in my case it was the enabling of HSTS that I had done to force the website to use HTTPS instead of HTTP.

To solve the problem I had to disabled HSTS in the applicationHost.config file, which is usally found here: C:\Windows\System32\inetsrv\Config\applicationHost.config

The relevant line of the file is this - I just changed enabled from true to false:

<hsts enabled="false" max-age="31536000" includeSubDomains="true" redirectHttpToHttps="true" />

Obvious you need to consider the security impact of disabling HSTS. In my case this is my development PC so I only had HSTS turned on to simulate what production does.

Upvotes: 0

user6307854
user6307854

Reputation: 129

If you can check your logs you should be able to get an error status and substatus.

Logs are usually located at %SystemDrive%\inetpub\logs\LogFiles

I just had to face a similar problem, looking at the log i've found:

2018-11-12 10:09:22 ::1 DEBUG /PPD/debugattach.aspx - 80 - ::1 - - 403 4 5 0

Here the status is 403 and substatus is 4, this table https://support.microsoft.com/en-ca/help/943891/the-http-status-code-in-iis-7-0-iis-7-5-and-iis-8-0 provided the knowledge to fix the problem! 403.4 is in fact SSL Required, once i've changed the project URL in Visual Studio from http to https (Project properties -> Web -> Server -> Project URL) the problem disappeared.

I've described my fix only to clarify the steps involved in fixing the issue, read all the answer and not just from "once i've changed the project URL..." and follow your logs!

Good luck!

Upvotes: 1

kfrosty
kfrosty

Reputation: 815

I went through every answer here and nothing worked. My situation was IIS and had a self signed certificate created a week ago. Worked fine for a week and all of a sudden I started getting the 403's. Finally I closed Visual Studio, went into IIS and deleted the virtual directory, went back in visual studio and created a virtual directory from the project web settings and everything started working again.

The self cert had a year expiration date so I'm not sure why it just stopped working but this got me back up.

Upvotes: 0

Edalat Feizi
Edalat Feizi

Reputation: 1401

In my case this problem happened after my windows 10 updated to the latest version

-I have tried most of above solutions but not helped me

-I also checked event viewer to see what error happened.

this is the error related to iis was happened but not found any solution on internet about it after a lot of search

The Module DLL 'C:\WINDOWS\System32\inetsrv\cgi.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.

enter image description here

The way i solve this problem is changing Enable 32-Bit Applications value to True

by right clicking on DefaultAppPool in IIS Manager and select Advanced Settings

enter image description here

Upvotes: 2

user3115190
user3115190

Reputation: 37

Project Properties > Web > Servers Change Local ISS > ISS Express

Change ISS

Upvotes: 3

Illidan
Illidan

Reputation: 4237

In my case it looks like Chrome locking some resources, preventing from debugger to attach. After I closing Chrome, I able to attach again.

Upvotes: 1

Make sure that you etc file in C:\Windows\System32\drivers does not has any other applications with the same name as the one you are getting an error on.

I had a Hadoop sandbox configured with the name 'localhost' which was the same as my Visual Studio project which was getting the 'Cannot start debugging on web server' error.

Remove those lines and your project should start debugging.

Upvotes: 1

Alan Guilfoyle
Alan Guilfoyle

Reputation: 381

I didn't see this answer on this thread or the (possible duplicated) question here.

I fixed the issue by:

  • Opening the Task Manager (ctrl+alt+del)
  • Under the Processes tab, End the task of IIS Worker Process (This may now be listed as Microsoft.IIS.Worker.Process or something similar) (You may have to click More details at the bottom if you don't see all of the processes)
  • Then going to the Services tab, Stop the IISADMIN service and the start it up again.

Run the program and that should hopefully fix it! Happy Coding and Debugging! :)

Upvotes: 13

Caius Jard
Caius Jard

Reputation: 74700

Just one of the 10 sites configured on my Local IIS was giving this error, so I had a feeling that it wasn't anything from the other answers that were machine-wide things, like Turning Windows Features On or Off, or running VS2015 as admin (the other 9 sites worked ok, in the same VS).

The specific error for me was:

Unable to start debugging on the webserver. Operation not supported. Unknown error:0x80004005

The problem turned out to be the web config having a URL Rewrite rule to rewrite HTTP -> HTTPS. Commenting this out resolved the problem

TL;DR - try disabling all your web.config URL rewrite rules, if you have them (then add them back in gradually, if it helps)

Upvotes: 7

mrmashal
mrmashal

Reputation: 1873

In my case it was the lack of debug="true" in web.config (system.web -> compilation).

example:

<system.web>
   <compilation debug="true" targetFramework="4.5.2" />
   ....
</system.web>

Upvotes: 14

Burk
Burk

Reputation: 3067

If you are using active directory login u need to check password and username.

Upvotes: 1

Jason Boyd
Jason Boyd

Reputation: 7029

In my case this folder was missing:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

Adding that folder and the necessary permissions solved it for me.

Upvotes: 1

LePrinceDeDhump
LePrinceDeDhump

Reputation: 486

I'm running Windows 10 Professional with Visual Studio 2017 and none of the options above worked for me.

What fixed it for me was adding 'Windows Process Activation Service'.

Start > Type turn windows Features On or Off > Make sure "Windows Process Activation Service" is checked.

Hope it helps someone.

Screenshot

Upvotes: 10

Kiran.Bakwad
Kiran.Bakwad

Reputation: 624

go to Search > type services.msc and make sure that ASP.Net State Service is running.

Upvotes: 5

Vijaykumar
Vijaykumar

Reputation: 11

Follow my steps :

  1. Open your web config file .
  2. See your 'staticContent' tag
  3. Delete or commend unwanted setting tag ex: -> < mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>

Upvotes: 1

Ricardo Valente
Ricardo Valente

Reputation: 591

Use Microsoft Web Platform Installer to install IIS ASP.NET 4.5

enter image description here

Found the solution here:

Upvotes: 0

Annie Lagang
Annie Lagang

Reputation: 3235

Thanks for all the answers but none of them worked for me. Although some of them gave me some ideas on what services and stuff that needs to be running to be able "turn on" the debugging of my web app again:

  1. Ensure that ASP.Net registered properly with IIS and running. To register it follow @Rahul Tripathi instructions then go to Search > type services.msc and make sure that ASP.Net State Service is running.
  2. As @Morvael suggested, always run your VS in admin mode.
  3. Check if the app pool where your web app resides is started.
  4. Ensure that the IIS server itself is running (this what solved the problem for me)

I still haven't figured out what is the reason why my IIS stopped. It was working fine yesterday then today it's not. Anyways, I hope this mini checklist helps somebody else. Cheers!

Upvotes: 0

Related Questions