74

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.

Community
  • 1
  • 1
sebastian
  • 837
  • 1
  • 8
  • 18
  • Possible duplicate of [Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64](http://stackoverflow.com/questions/4653236/unable-to-start-debugging-on-the-web-server-could-not-start-asp-net-debugging-v) – Sayed Abolfazl Fatemi Oct 05 '15 at 15:16
  • 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? – Ashish Shukla Apr 09 '18 at 05:53

44 Answers44

45

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
TPAKTOPA
  • 2,462
  • 1
  • 19
  • 26
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • @sebastian:- There can be many reasons for the issue which you reported. I have added the link. Do check that!!! – Rahul Tripathi Sep 08 '13 at 06:20
  • @sebastian:- Updated my answer. Check if that helps!! Check if “Anonymous Authentication” is enabled. – Rahul Tripathi Sep 08 '13 at 06:28
  • should i type the whole thing in my commandprompt? vs cmd or system cmd? – sebastian Sep 08 '13 at 06:30
  • Microsoft.NET\Framework\v4.0.30319 is not recognised as an internal or external command is the error im receiving – sebastian Sep 08 '13 at 06:34
  • @sebastian:- I hope you are specifying the correct path of the Microsoft.Net folder in your system and you want 4.0 framework!!! – Rahul Tripathi Sep 08 '13 at 06:36
  • In my case, the AppPool was started - but recycling it fixed the problem – Bob Gear Jun 11 '17 at 14:18
  • 4
    I'm adding this note for my own benefit and hope it helps others: every few months the service account for our dev platform application pool (don't ask why it's done that way) password changes, and the app pool shuts down. Just update the password for the app pool and it'll work. – Bill B Dec 08 '17 at 17:06
  • In my case, the AppPool was stopped because of Rapid-Fail Protection. This happened because tests caused too many errors in short period of time. You may increase Maximum Failures in AppPool's Advanced settings to avoid this. At least on developer's machine. – Viacheslav Shchupak Jan 29 '19 at 12:29
  • in my case I have executed this command: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Aspnet_regiis.exe -ga domain\user – Bhaskar Singh Mar 25 '21 at 17:11
39

There are multiple solution of this problem, in my case I changed my machine's password but forget to change it in the process model identity of Advance setting of that Application pool.

Later IISRESET did the trick for me.

AuserP
  • 469
  • 5
  • 6
22

Just an update as I hit this issue and all of the settings in both Visual Studio and IIS seemed to be correct.

What actually worked for me was simply running Visual Studio as an administrator - I'm guessing that there is a permission that needs to be set somewhere, but I have no idea what or where.

Also a point to note is that I configured all my websites to use the DefaultAppPool in IIS which at the time was ASP.NET V2, then installed .NET 4 and the DefaultAppPool was converted to .NET4 so none of the sites would compile (that caused me a small amount of swearing)

Hope that helps someone

Morvael
  • 3,478
  • 3
  • 36
  • 53
21

I've seen alot of different solutions for this. iisreset did the trick for me.

Just open an elevated command prompt and type:

iisreset

Norrin
  • 385
  • 2
  • 8
14

Just to add, I had this issue, and fixed by disabling the Load User Profile option (unsure of any side effects). This is found through Advanced Settings for the Application Pool.

enter image description here

This then made it work for me.

askrich
  • 598
  • 5
  • 20
13

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! :)

TristanKJ
  • 33
  • 1
  • 7
Alan Guilfoyle
  • 381
  • 4
  • 13
13

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>
nologo
  • 5,918
  • 3
  • 36
  • 50
mrmashal
  • 1,721
  • 18
  • 21
10

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

LePrinceDeDhump
  • 436
  • 6
  • 18
6

in my case, the DefaultAppPool was stopped, I edited the Advanced Settings and set the value of Identity as LocalSystem, after that I start the DefaultAppPool.

Josue Barrios
  • 440
  • 5
  • 10
6

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)

Caius Jard
  • 72,509
  • 5
  • 49
  • 80
  • Thanks for this hint. Identical error was also only happening on one out of many projects, so I went through the web.config until I found what triggered it. For me it was the custom errors section! – Jamie Kitson Mar 18 '22 at 14:57
5

Just had the same issue after VS crashed and Rahul's comment regarding the application pool pointed me in the right direction. In my case recycling the app pool did the trick (IIS Manager => App Pools => right click on ap in question and recycle).

devlock
  • 959
  • 1
  • 9
  • 14
5

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

Kiran.Bakwad
  • 614
  • 7
  • 4
4

The best answer online is at here. I tried the fifth method.

  1. Right click on your project in VS2005 or VS2008 or VS2010
  2. Click on Properties
  3. Click on Web tab
  4. Under Servers, click on the radio button Use Visual Studio Development Server
  5. Check Auto Assign Port radio button
  6. Uncheck NTLM Authentication and Enable Edit and Continue

Now run your application it will work for you.

  • thanks. It works with Local IIS option too. If you click "Create Virtual Directory". Even if it is already setup, clicking that button has fixed my issue – adeel41 Jan 30 '17 at 14:59
  • That went well. Thanks. This should be a good solution if anybody using different versions of VS instances in one workstation. – Anoj Sep 23 '21 at 18:56
4

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.

live-love
  • 48,840
  • 22
  • 240
  • 204
3

reset your iis in 'Developer Command Prompt for (your visual studio version)'

type iisreset in that command prompt & hit enter. it'll reset iis automatically

sinhayash
  • 2,693
  • 4
  • 19
  • 51
gowtham ks
  • 427
  • 5
  • 6
2

I resolved this issue. In my case my application pool was stopped. After little bit of Googling i found out that application pool was running under some user identity and password was changed for that user. After updating password it starts working fine.

arpan desai
  • 889
  • 2
  • 13
  • 23
2

If you are using HTTPS on localhost, odds are you created a self signed certificate. These have a tendency to expiry on the same day they are created, so you could have to recreate a certificate and add it to the binding of your locally hosted site.

Peter PitLock
  • 1,823
  • 7
  • 34
  • 71
2

Just ran into this problem myself and it turned out to be that my site in IIS was set up to use anonymous authentication with a specific network account. I had been forced to reset the password on that account, and so IIS was failing because it was using the old one. Once I updated the site with the new password (or even better, changed it to use Network Service instead), all worked again.

2

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

Change ISS

2

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

Edalat Feizi
  • 1,371
  • 20
  • 32
  • 1
    While this did work for me, I would HIGHLY suggest you do not edit your `DefaultAppPool` settings - as a Best Practice. Instead, create a **new** App-Pool and name it with "`32-Bit`" in the name (or the name of your Web Application - if it will _only_ be used by that 1 App). Otherwise, you risk mucking up the works with existing Applications that are already using the `DefaultAppPool` - or future Applications that will. – MikeTeeVee Jul 07 '20 at 20:57
  • @MikeTeeVee i didn't have enough information about this risk, thanks for pointing this out. – Edalat Feizi Jul 08 '20 at 12:07
2

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.
warlockdead
  • 131
  • 1
  • 1
  • 8
1

Do you use or have IIS Rewrite installed on your machine? I have a similar problem on my machine but to get round it, I have web.config open as the current page in VS and press f5. I then have to navigate to the page to debug. It seems to work for me.

MiscellaneousUser
  • 2,915
  • 4
  • 25
  • 44
1

I edited the solution file and changed localhost to my ip address. Before that I had added IIS_IUSRS with full control in the project directory. I can now debug.

1

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"/>
Vijaykumar
  • 11
  • 4
1

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.

Jason Boyd
  • 6,839
  • 4
  • 29
  • 47
1

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

Burk
  • 2,969
  • 1
  • 23
  • 24
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.

1

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

Illidan
  • 4,047
  • 3
  • 39
  • 49
1

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!

user6307854
  • 99
  • 1
  • 4
0

I've faced this problem, then I found out that i gotta run Visual Studio as admin in order to debug the project.

Hope it helps!

0

I had the same issue. The problem was I haven't Framework 4 installed while I had already Framework 4.5 So MIME type ASPX could not be realized without ISAPI 4.0.

To sort it, I could either uninstalled 4.5 first and add 4.0 then which made trouble or adding specific files to ISAPI restriction and ISAPI filter in the IIS root manually. I needed to grab aspnet_filter.dll and aspnet_isapi.dll located in both C:\Windows\Microsoft.NET\Framework\ and C:\Windows\Microsoft.NET\Framework64\

Having added those files, all would be good.

Nelly Sattari
  • 2,613
  • 1
  • 12
  • 14
0

None of the other solutions worked for me. I resolved this issue by using the commands below.

For 32 bit machine:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis –i

For 64 bit machine:

C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis –i

The issue is because the web.config file is not installed correctly.

Pang
  • 9,564
  • 146
  • 81
  • 122
0

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!

Annie Lagang
  • 3,185
  • 1
  • 29
  • 36
0

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

enter image description here

Found the solution here:

Ricardo Valente
  • 581
  • 1
  • 10
  • 14
0

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.

kfrosty
  • 805
  • 1
  • 8
  • 14
0

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.

Mike
  • 1,686
  • 19
  • 14
0

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.
James
  • 1,979
  • 5
  • 24
  • 52
0

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

Shaya
  • 2,792
  • 3
  • 26
  • 35
0

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

Jonathan Applebaum
  • 5,738
  • 4
  • 33
  • 52
0

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=::
Nicolas
  • 2,277
  • 5
  • 36
  • 82
0

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"/>

brianjlowry
  • 51
  • 1
  • 4
0

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

Iria
  • 67
  • 9
0

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>
Daniel
  • 2,167
  • 5
  • 23
  • 44
0

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

Jeevan ebi
  • 105
  • 12