VS2010 error: Unable to start debugging on the web server - asp.net

I get error message "Unable to start debugging on the web server" in Visual Studio 2010. I clicked the Help button and followed the related suggestions without success.
This happens with a newly created local ASP.Net project when modified to use IIS instead of Cassini (which works for debugging). It prompts to set debug="true" in the web.config and then immediately pops up the error. Nothing shows up in the Event Viewer.
I am able to attach to w3wp to debug. It works but is not as convenient as F5.
I also have a similar problem with VS2008 on the same PC. Debugging used to work for both.
I have re-registered Framework 4 (aspnet_regiis -i). I ran the VS2010 repair (this is the RTM version). I am running on a Windows Server 2008 R2 x64 box.
I do have Resharper V5 installed.
There must be some configuration setting or registry value that survives the repair causing the problem.
I'd appreciate any ideas.

Disable the loopback check
(original microsoft page here)
To set the DisableLoopbackCheck registry key, follow these steps:
Click Start, click Run, type regedit, and then click OK.
In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Right-click Lsa, point to New, and then click DWORD Value.
Type DisableLoopbackCheck, and then press ENTER.
Right-click DisableLoopbackCheck, and then click Modify.
In the Value data box, type 1, and then click OK.
Quit Registry Editor, and then restart your computer.

I got a new PC with Windows 7. I installed VS2010 and my development environment and hoped my F5 debug problem would be gone, but it still failed to start the debugger.
This was a good clue since it ruled out the install of software.
I finally traced it down to my HOSTS file. I had an entry for some of my local websites which I can access like "http://testsite.lcl" but the IP I had assigned was my machine's IP instead of using 127.0.0.1 so it looked like a remote server to VS2010. Changing back to 127.0.0.1 resolved the issue.
Thanks for everyone's help on this.

I had the same problem. How did I fixed it.
Go to IIS (in my case IIS 7 / Windows 7).
Select your web site from the list, click on .NET Compilation in ASP.NET section. Select Open Feature. Check if your Debug is set to True. In my case it was False. Once I changed it to True - I have my debug back :)

These steps my differ depending on your version of Windows. I am using 7 with iis 7.
Open IIS Manager, click on Application Pools and find the 2 ASP.NET v4.0 pools (One is called "ASP.NET v4.0" the other "ASP.NET v4.0 Classic". Chances are that first one is stopped. Do not start it yet, we need to investigate a bit more.
For the "ASP.NET v4.0" pool, check the name in the Identity Field. Is it ApplicationPoolIdentity? Remember the name.
Open Computer Management (right click on My Computer and select Manage). Expand Event Viewer, then Windows Logs. Click on Application and wait for the data to load. There should be an error with a source of User Profile Service with a message that starts with "Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, and that your network is functioning correctly."
If you do find that, then you have the same problem as I did.
The Solution: Go back to IIS Manager and right click on "ASP.NET v4.0" and select Advanced Settings. Under Process Model, the first field is Identity. Change this from ApplicationPoolIdentity to NetworkService. Click OK.
Now start the pool if it did not restart automalically. Go back to your application and press F5 (start debug) and your application should work.
Please note that I have not figured out why this works, and this may be a security risk, but at least you will be able to do some work while you think about this.

I had this problem in Visual Studio 2012 when running a website I had created in Visual Studio 2010. I tried each of the following, which did not solve the problem, but still may have been required:
Checked that the App Pool was targeted to the same framework as what was specified in the web.config
<compilation defaultLanguage="c#" debug="true" targetFramework="4.0">
Started the 64bit Remote Debugger: \Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe
Set the DisableLoopbackCheck registry key and restarted Windows. MS Instructions here
Browsed the site locally (it came up just fine).
Finally I found the IIS setting that fixed the issue.
Go to IIS (7.5 in my case) and click on the relevant site in the Sites node.
Double click .NET Compilation in the ASP.NET section
Under Behavior, set Debug to True.
Click Apply and run the site in Visual Studio.

You can firstly deploy your web application/site with your iis, then open your visual studio 2010. Then click "File"->open->website->Local IIS Site, then select your website/application. Then you will find that the debug may works. This method works for my case.

I had the same issue on Win7 and VS2010 (without ReSharper) and found that Skype listened on port 80. IIS listens to port 80 by default. This can occur when you set VS to debug an existing web application running in IIS instead of the built in ASP.NET debug web server.
I solved the issue by unchecking "Use ports 80 and 443 as alternatives for incoming connections." in Skype under Tools -> Options -> Connection, followed by a restart of Skype.

What worked for me was to go into IIS at the server level, click on ISAPI and CGI restrictions, I found that aspnet_isapi.dll for asp.net 4.0 was set to Not Allowed. I set it to allowed and debugging worked. The steps are:
Open IIS.
Click on the top level
Select ISAPI and CGI Restrictions under IIS in the Features view
Examine the Descriptions and if ASP.NET v4[current version] has the Not Allowed Restriction, click on the "Allow" link in the Actions section of the dialog.
This change should take care of the problem. Note that I came up with this solution when I tried to run the web app withoug debugging and I came up with the following error:
HTTP Error 404.2 - Not Found
The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.

Another thing to try (this is what worked for me):
In IIS, click Application Pools > (Your Site) > Advanced Settings, and change "Enable 32-Bit Applications" to True.

I don't have a definite answer though these articles may have some helpful info:
Using Windbg to start with w3wp.exe This mentions windbg/cdb debuggers specifically, but this advice should work with Visual Studio talking to cdb (which is attached to w3wp).
Remote debugging with Visual Studio The reason I mention remote debugging at all is that I had to use that a few times in the past to get Visual Studio to attach to w3wp.exe. W3wp.exe runs in a different session, so you can't directly attach a debugger to that.

You have not mentioned what operating system you are using. But this might not be related to operating system. I am taking a guess here. If you are running on Windows 7, try running visual studio under Administrator previlages.
You can also try adding your user ID to the VS debugger users group. You can access user groups by reight clicking on computer name or my computer and selecting Manage. Under that you can find Users & Groups.

In IIS in the Directory Security TAB, if using SSL check "Ignore client certificate" if you are running it in your local PC.

I was getting this after a new install of Windows 7 that did not include IIS by default. After installing IIS, the default app pool was created to run under .NET 2.0. Though I was able to set the default App Pool to .net 4 from .net 2, I still got this error. I had to reinstall .net 4 in IIS to get it to work properly. That is, run C:\Windows\Microsoft.NET{FrameworkFolder}\v{FrameworkNumber}\aspnet_regiis -i

What worked for me was to edit the HOSTS file in the C:\Windows\System32\drivers\etc folder and set the loopback for the website name I'd setup.
For example:
127.0.0.1 http://guyellisrocks.com/

I've had the same issue and in my case it happened because the AppPool identity was set to impersonate an AD user which had its password changed. Therefore the process could not start and the AppPool always stopped when trying to debug from VS.
After updating the password in the AppPool/Advanced Settings/Identity everything started running smoothly.

Check whether the msvsmon.exe (Visual studio Remote Debugging Monitor) file is existing in the below path:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x64
If the file does not persist on the above mentioned path,then you need to get it from any other machine which is having the same version of Visualstudio.

Having tried all of the solutions above, I was still having this issue. Other projects were debugging without issue, so I knew it had to be something to do with this particular application's configuration.
Mine is an MVC app running under IIS 8. The issue was with URL Rewriting.
I had a rule to enforce trailing slashes. All I had to do was disable it (which can be done in IIS directly, or via the web.config below - just set enabled="false")
<rewrite>
<rules>
<rule name="AddTrailingSlashRule1" enabled="false" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>
</rules>
</rewrite>

Unload project, right click "edit abc.csproj" You will see the configuration.
If your project is mapped to use IIS Web Express url.
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>6270</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://matrimonyfree.in/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
verify If you have started the web site in IIS
http://matrimonyfree.in in this case

It may also be because of some special or illegal format in your config file i will suggest you to check for that first .
In my case i was getting an error because of that when i tried to browse my service from IIS it showed me the real error .

I tried every single solution put online to resolve this issue and nothing seems to work consistently.
I eventually solved it in both 2010 and 2012 by tracking it down to the following missing file in the Debug Source Files setting
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\
Solution > Properties > Debug Source Files >
Check to ensure all the files are there then remove this entry and everything worked again.

Did you change your bindings on your IIS website? If so, you need to go to your project properties, select the Web tab, and change the Project Url to match your binding. so where it says http:///yourwebsite change it to http:///yourwebsite
This worked for me.

In my case it was the system.webServer > httpErrors > errorMode in the web.config that caused the problem.
If you have errorMode="Custom" try this:
<httpErrors errorMode="DetailedLocalOnly">
See this answer: https://stackoverflow.com/a/15585629/631277 for variations and other ideas concerning URL rewriting

I had same issue with Visual Studio 2013. In my case I had removed the "Default Web Site" from IIS. To resolve the issue I created the default website again, set physical path to C:\inetpub\wwwroot and port to 80 (default port). After restarting the Visual Studio it worked perfectly. Hope it helps someone.

Unable to start debugging on web server. the web server not configured correctly.
How to resolve this problem?
Step-1
open Command Prompt (Run as administrator)
Step-2
C:\Windows\system32>cd..
C:\Windows>cd Microsoft.NET
C:\Windows\Microsoft.NET>cd Framework
C:\Windows\Microsoft.NET\Framework>cd v4.0.30319
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i

Your solution file in visual studio is broken. It's a known issue when converting from a file-system website to an IIS website, and it has been carried over from 2008 to 2010. Not sure of the location for the bug report on ms's kb site, though.
Remove the website from the solution file (right click the project name, click "remove"). Then right click the solution name, click "add existing web site". When the dialog to add a web site comes up, choose "from IIS" in the left-hand pane. Navigate to your application in IIS, select "use secure sockets layer" if necessary, and click "finish" (or whatever that button is labeled).
this will permanently fix the issue.

Unable to start debugging on web server. the web server not configured correctly.
How To Resolve This Problem?
Step-1
open Command Prompt(Run as administrator)
Step-2
C:\Windows\system32>cd..
C:\Windows>cd Microsoft.NET
C:\Windows\Microsoft.NET>cd Framework
C:\Windows\Microsoft.NET\Framework>cd v4.0.30319
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0 Administration
utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved. Start
installing ASP.NET (4.0.30319.0). .................. Finished
installing ASP.NET (4.0.30319.0).
C:\Windows\Microsoft.NET\Framework\v4.0.30319>

One of the things to check is to make sure if IIS is up and running. Something as simple as that would resolve this issue sometimes.

Related

IIS7 MVC Routing Not Working

Our company ships an MVC based product (targeting v4.5) which has stopped working on a customer site for what appear to be environmental issues - a build which worked with no problems once upon a time now gives a 403.14 - The Web server is configured to not list the contents of this directory.
.
What I think is happening...
The user accesses http://server/AppName
Because it's an MVC app, the default route (Reports/Index) should be used.
Instead IIS is looking for a default document...
... and, not finding one, it assumes the user wants to list the contents of the directory...
...which is not enabled so it throws a 403.14.
.
What I've tried so far...
Accessing the route directly.. results in 404 error. So I'm pretty
sure IIS doesn't realise it should use routing.
Use aspnet_regiis to register ASP.Net with IIS. This was done from the Framework64 folder since...
OS is 64 bit - Windows Server 2008 (Standard without Hyper-V)
IIS is 64 bit - though Enable 32-Bit Applications is true
Checked AppPool is targeting v4 of the framework - it is.
Changed AppPool mode to Classic - was pretty sure it should be integrated but was worth ruling it out. It is now back to Integrated
Confirmed RunAllManagedModulesForAllRequests is set to true in the web.config.
Checked permission conditions defined in <system.webServer> section of web.config are met - they are.
Created the simplest of MVC applications and deployed it - same problem.
Running the command shell as Administrator unregistered ASP.Net using aspnet_regiis -ua and re-registered using aspnet_regiis -enable -i. We hit a couple of permission problems - and the Temporary ASP.NET Files directory was missing but once they were address we were back to the same error.
Added a simple default.htm - when present, this is served in response to the http://server/AppName request.
I'm clean out of ideas and all google hits suggest some combination of the above - or enabling directory browsing (which I think is just a symptom rather than the root cause).
Also, not sure if it's relevant but the amount of configurable elements available for the application in IIS seems a bit below what I would have expected...
Have you Checked the user the application pool process is running under? I think Your site needs to run with permissions to execute the .net libraries and I've seen this just change for seemingly no reason (probably related to an overzealous update to the system).
You can try with the Enabling directory browsing .
assuming you are under Windows Server 2012 or Windows Server 2012 R2
On the taskbar, click Server Manager.
In Server Manager, click the Manage menu, and then click Add Roles
and Features.
In the Add Roles and Features wizard, click Next. Select the
installation type and click Next. Select the destination server and
click Next.
On the Server Roles page, expand Web Server (IIS), expand Web
Server, expand Common HTTP Features, and then select Directory
Browsing. Click Next.
On the Select features page, click Next. On the Confirm installation
selections page, click Install. On the Results page, click Close.
if you using the Windows PC try this in your command prompt as follows:
go to C:\Program Files\IIS Express
then press Enter:appcmd set config
/section:system.webServer/directoryBrowse /enabled
Maybe this is your case https://forums.iis.net/t/1157304.aspx
SQL Server Reporting Services creates a folder called Reports by
default if you install it on IIS. If you install SQL 2008 then
Reporting Services doesn't need to use IIS and instead will try to
reserve the URL with the HTTP.Sys service.
I believe this is the cause of the conflict you are seeing. What you
could try is changing the URL that Reporting Services uses via the SQL
Server Configuration Wizard.
Also I found that
Report Manager of SQL Server can use reports path http://<server name>/reports
Configure a Native Mode Report Server for Local Administration (SSRS)
I think the problem is IIS features that are not installed yet. I have met this kind of problem frequently in Windows Pro. Make sure to turn on every feature under Internet Information Service -> World Wide Services because by default IIS is configured to use WebForms. So there might be some features that not installed yet to use MVC, especially ISAPI filters. In my case, that was the solution. I hope it helps.
Something similar i encountered using VS 2017 & ASP.NET MVC.
Was working on the project for long with no problems at all but suddenly the routing started misbehaving & stopped working.
So I changed the Port in Project Properties Page & it started working.
I really don't know what is the relation between a port & MVC routing modules. Someone else can enlighten if at all this helps.
I had the same problem and I just created an application pool out of the Default Web Site in IIS and stoped the default web site. With that difference you will not have the application pool's path
I know it's been a long time since this question but i've had the same problema recently. I've tried every single configuration, just like #amcdermott did, but the only action that solve the problem was reinstalling .NET Framework.
My app was built under .NET Framework 4.5.2. The application server had the version 4.6.1 and 4.5.2 installed. So, i uninstalled all framework versions and installed the one that i needed.
Please, make sure that no other applications use superior versions of .NET Framework if you going to try this solution.
Here are some quote I find on Microsoft official site which I think may help:
For site administrators
This problem occurs because the Web site does not have the Directory Browsing feature enabled, and the default document is not configured. To resolve this problem, use one of the following methods:
Method 1: Enable the Directory Browsing feature in IIS (Recommended)
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Directory Browsing.
In the Actions pane, click Enable.
Method 2: Add a default document
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Default Document.
In the Actions pane, click Enable.
In the File Name box, type the name of the default document, and then click OK.
Method 3: Enable the Directory Browsing feature in IIS Express
Note This method is for the web developers who experience the issue when they use IIS Express.
To do this, follow these steps:
Open a command prompt, and then go to the IIS Express folder on your computer. For example, go to the following folder in a command prompt:
C:\Program Files\IIS Express
Type the following command, and then press Enter:
appcmd set config /section:directoryBrowse /enabled:true

The requested content appears to be script and will not be served by the static file handler.IIS 7.5

I know there are related posts here on this forum and another resources but I got stuck with this and couldnt proceed.Problem is i've done a website with vs2010 when i publish it to ftp server and navigate to url adress I got this error. Here the things that i've done
-I've enabled IIS services and static content
-I've revert to parent the staticFile under handler mappings
-I've registered the asp.net again in command prompt(the regiis.exe thing)
-In IIS manager i've added my website adress under sites, stopped default web site and started mine.
-I've added my site to classic.NET AppPool(integrated,and v4.0)
-I've enabled the default browsing..
-I've done all the advices that generally covered..
Here is my web.config
<configuration>
<system.webServer>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" />
<defaultDocument>
<files>
<add value="AnaSayfa.aspx" />
</files>
</defaultDocument>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
where am I doing mistake? I've spent 2 days and couldnt proceed an inch.I will burst into tears if this problem solved.Any help will be greatly,greatly,greatly! appreciated,will be my hero,master (: thanks
Go to Command Prompt and install / repair ASP.NET
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
Go to IIS => Select the Server Name (System Name)
Go to ISAPI and CGI restrictions
Allow the Not Allowed restrictions.
I got this working when i change the app pool's .Net framework version to my application's .net framework version.
My application's framework version was 4.0 but app pool's setting was defaulted to 2.0. I had to change it to 4.0, then it worked fine.
+1 with #Dablue, IIS 8.5 does not support the aspnet_regiis command anymore. For me, the issue is resolved by installing the "Asp.Net 3.5" or "Asp.Net 4.5" under
Web Server > Application Development.
#regeme - I was experiencing a similar problem when trying to run my own site and after a lot of digging I finally resolved it. In my case it was related to a *.json file trying to be loaded and no rules being initialized for it. If you look closer at your error it should give you an idea of what it is IIS is not loading.
After looking at the web inspector's network tab I was able to see which items were returning 404's they were all *.json.
I'm assuming since your error is returning a "content appears to be script and will not be served by the..." it is the same case.
My resolution:
A) It is possible you have already done this as it would throw another error, I'm just covering our bases.
Go to IIS HTTP Response Headers
create a mime-type ".json" "application/json"
B) **SEE NOTE
Go to Handler Mappings.
Set Request Path: to "*.json"
Executable: to "C:\Windows\System32\inetsrv\asp.dll"
C) You may want to restart your service at this point again just to be safe this can be done in the IIS panel or cmd prompt.
Windows key + r
type: cmd and hit ctrl+shift+enter
type: iisreset and hit enter
*NOTE: This may save you a lot of headache, in my case I installed the 64 bit dll of asp.dll instead of the 32 bit version the folder for the 64-bit version is in C:\Windows\SysWOW64\inetsrv\asp.dll
IMPORTANT these file locations are in windows 8 and to my understanding are the same in windows 7 but this may not be the case for your OS double check.
Lastly if you are missing the asp.dll this is simply because you are missing windows features. Simply go to add/remove programs (Programs and Features)
Turn Windows features on or off
drop down Internet Information Services
drop down World Wide Web Services
check Application Development Features make sure it's not just a partial check and that all sub-items are being installed
On Windows 2012 and IIS 8.5 aspnet_regiis is no longer valid.
Instead, add the aspnet-4.5 rolefrom within server manager
Open server manager
in the left column select IIS
Scroll the right window until you see "Roles and Features"
Tasks select Add roles
Under "server roles" open "Web Server (iis)
open "Web Server"
open "application development"
Select "ASP.NET 4.5" (the "asp.net 4.5 extensibility" will not do it)
We got the same issue when hosting our MVC application on the web server. All the applications were working fine except the WCF service.
It was resolved, when we added a server role for .NET Framework 4.5 WCF service in Windows Server Manager.
Visit http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2013/02/08/how-to-enable-and-use-net-framework-3-5-and-4-5-in-windows-server-2012.aspx
For me the issue was fixed by right click on Virtual directory-->convert to application
Check out this, in my case this solved the problem
https://support.microsoft.com/en-us/kb/2019689
This might help you
In this case, a 404.17 error is returned if the *.aspx resource being requested from the site is handled in an Application pool that is not running in Classic Mode, is not 32 bit, or is not running the 2.0 version of the .NET Framework. In order for the resource to be served correctly in this example, all 3 pre-conditions must be met. Specifically, the application pool hosting this resource would have to be configured for Classic Mode, it would need to be configured to use the 2.0 version of the .NET Framework, and it would need to be set for 32 bit applications.
I had to create a new Web Site. There was some invalid configuration in my Website level that referenced my application's virtual directory directly.
For example, https://server/app gives me the 404.17 error but https://server/app-test works successfully. Swapping the two application names (using appcmd) caused the working app-test (now renamed to app) to begin failing. After creating a new Web Site named MyApp Web Site I was able to again create a new app, this time named app that worked successfully.
After extensive review of Default Web Site we cannot identify what configuration is causing 404.17 for apps named app and not alternatively named apps like app-test.
I believe the ultimate cause of this, is I did not have .NET Extensibility Services and ASP.NET 4.5 added through the server roles and features—During installation. Thus, the installer of my app failed to successfully configure Default Web Site correctly. For example, the created app pool incorrectly installed with v2.0 Integrated and not v4.0 Integrated. After installing the required roles and features I verified ISAPI (64 bit v4) was configured correctly, and the App Pool was appropriately configured for v4 Integrated. Unfortunately, I cannot identify any additional settings that would cause this issue—especially explicitly targeting the app virtual path.
This solved the issue for me. +1 to all who spoke a reasonable solution without having to pass through a 3 ring circus.
Turn on IIS Windows Features like these

trying to do asp.net mvc development from vmware fusion

the issue is that my source is hosted on the host machine (in this case a mac book pro) and visual studio wants to be able to monitor the web.config for changes so it is throwing the error:
An error occurred loading a configuration file: Failed to start monitoring changes to: \path\to\web.config
I have tried to add the HKLM\Software\Asp.Net\FCNMode=1 but it doesn't seem to work. Also, I don't see moving the source to the VHD as a viable option due to version control issues.
Windows 7 64-bit
Visual Studio 2008
VMWare Fusion 3.01
Thanks.
You have the right idea, but need to edit the correct key for Windows 7.
Open up RegEdit
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ASP.NET
Add a REG_DWORD registry entry called FCNMode and set its value to 1
Re-boot and you should be good to go. The "Wow6432Node" allows you to set this for Windows 7 64-bit Visual Studio.
It looks like you can now change FCNMode in your web.config. They probably added it in .NET 4.5, could not find any of documentation but this, but it seems to work.
<system.web>
<httpRuntime fcnMode="Disabled"/>
I'm no filesystem/virtualization expert but I'm guessing that the account that the dev server process is running under does not have permissions to access the configuration file (web.config). The accounts within your VM won't recognized by OS X either so you won't be able to change the permissions to get it to work in this way.
What I would suggest would be to add the IIS component (via Control Panel->Programs->Turn Windows Components on or off) if you haven't already. Then add an application to IIS with the virtual directory within the VHD of your VM. Now to debug, first publish your application to the newly created IIS application (something like http://localhost/MyNewIISApplication) and attach the VS debugger to the IIS worker process w3wp.exe (i.e. Debug->Attach to Process...).
I don't see a problem having the working copy of your code on a VM if the code repository is somewhere else.

Error : "Unable to start debugging on the web server..." ASP.NET 4.0

I am getting an error when I want to create a web site on IIS server. I am using Windows 7 and Visual Studio 2010.
Do I have to register or configure asp.net 4.0 for the IIS ?
There aren't many details here, but I was getting that same error while trying to Start Debugging on a web application project in Visual Studio 2010 that I'd just changed from 3.5 to 4.0.
This solved the problem for me from the command line:
cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i
Just make sure to go into IIS Manager afterwards and double-check your application pools and such, since it's likely that this will reset some of your configuration.
This did the trick for me:
In IIS > under .NET compilation
Note: Default Website is selected only for screenshot purposes.
Changing the Debug option to True
This error can appear if the password for the account used by the application pool changes. If you start getting this error after changing your network password you may need to update it for the application pool used by your local web sites as well.
In Visual Studio 2010 this usually means there is a problem with Web.Config file that cannot be displayed in Debug mode. So, simply start the app using Ctrl F5 to run in normal mode will tell you which line in Web.Config is faulty.
Check that the path of your site in IIS points to the path of your web project in VS.
I ran across this before and it was an issue of mismatched paths. If you've configured Visual Studio to use IIS and later on changed paths, IIS isn't updated automatically. You need to manually go into IIS and update the path.
Make sure your site is setup to debug (debug="true") under web.config file
<compilation targetFramework="4.0" debug="true">
For me this was related to this solution: http://www.codeproject.com/Questions/83338/Does-not-have-write-access-to
cd %windir%\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis -i
aspnet_regiis -ga "IIS APPPOOL\DefaultAppPool"
Note this didnt work after I did it on Framework folder and then worked after I did it on Framework64 folder. I guess do both to be sure.
Tried running vs2010 as administrator?
Also try
1. Open IIS. Click “Default Web Sites”.
Check if “Anonymous Authentication” is enabled.
Enable “Windows Authentication” as well.
I've had this several times - in my case it's always that I've not updated my hosts file so VS is trying to locate an external DNS instead of my local one.
I spent a few hours fighting with this issue. In the end it seems to be that some changes made outside VisualStudio had confused it. I don't know what the issue actually was but things started to work again when I opened a different version from the same solution so that VisualStudio (or IIS) did some magic on the IIS configuration. Then I changed back to the original solution, the configuration was again modified - and now debugging works again.
Another reason would be if you have SSL Certificate installed on IIS. You will have to disable the SSL from IIS manager for the application that you are debugging. Because Visual Studio tries to launch it as http instead of https.
In my case, I was receiving a 0x80004005 error message box in VS2019.
That was caused by HSTS being enabled in the "Advanced properties" on the website.
Screenshot of advance site settings in IIS
Found this post which seems useful if someone wants to do debugging with HSTS being enabled: https://scatteredcode.net/debugging-on-localhost-with-hsts/
I get this same error every time I set my project file as a share.
I resolved it by going into the security tab of the file and re-adding "IIS AppPool\DefaultAppPool"
In my case, i have to change the certificates bindings in IIS>Default Web Site > Binding.
IIS Binding
If you are using Visual Studio, you need to check what server you are trying to run your application on.
Right click on the project
-> Web
-> Servers
-> In the first dropdown choose "IIS Express" (To debug with VS).

Problems running ASP.NET application with IIS

I have written a small ASP.NET application. It runs fine when running it with the small IIS installation that comes with Visual Studio 2005, but not when trying with IIS. I created the virtual directory in IIS where the application is located (done it though both IIS and VS 2005), but it does not work. In the beginning I thought it might be caused by the web.config file, but after a few tests, I think that the problem lies with IIS (not certain about it).
Some of the errors that I get are
Unable to start debugging on the web server. The underlying connection was closed: An unexpected error ocurred on a receiver. Click help for more information
Can anybody give me a suggestion of what to try next?
Have you run aspnet_regiis?
Here's an overview site for different IIS versions setup and should help if there are other questions/issues
Try reinstalling aspnet_regiis.exe.
If you are using .net frameworkype 4.0 and using 64 bit system,
Go to Run, Type cmd and Command Prompt will be up, then type
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
If you are using 34 bit system,
Go to Run Type cmd and then type
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
The site won't load at all or you can't debug remotely?
Some thoughts:
Make sure you've got debugging enabled in your web.config, if you're trying to debug. Otherwise, build in 'Release' mode.
Make sure your project is set as an application, and is running as the correct version of .NET
More description of your setup and the error message would be useful.
Make sure that the customErrors is set to off in the web.config. That should show the actual exception.
Make sure that your virtual directory in IIS is set to the correct version of the .NET framework.
Look at the properties in the virtual directory and see that the correct default documents are the ones that you are using in your dev project.
Also look at the url headers for the website in IIS.
On some of our servers we have both versions of the .NET framework. In IIS I typically have to set what version the virtual directory should be using. This can cause problems running it on the server.
First make sure you have installed and configured IIS server. To check whether IIS server is installed: Run->inetmgr press enter.
To know how to install and configure IIS server check the following Link:
http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/
To develop Website using Visual developer with IIS instead of "default ASP.NET Development Server", In the new website window under "Location" click on "Browse" to see the different Server options including IIS Server. User can select the server as IIS server instead of "File System", then the "Location" option will be "HTTP" instead of "File System".
In Visual developer 2008 under Properties->Start Option->Server->"Use local IIS server" option is not shown, Even though IIS server was installed and configured successfully. the only options shown are "use default server" and " Use custom server with base URL".
So in Visual developer 2008 to run on IIS server(If IIS server is installed), Need do the following:
New Website -> Under Locations Click on "Browse" -> Click on "Local IIS" and then select the "IIS Virtual Directory"(IIS vitual Directory which is directory created by the user while configuring IIS server) -> Open
While Running/debugging, the server which you selected while creating the website, the same server will used to open the website, that is while creating the website if you selected "IIS Server" then the website will be opened though IIS server.
One more thing is, while installing Visual developer 2008 and IIS server, If you installed IIS server after installing Visual studio then you need to do the following before creating new website:
Run ->cmd press enter (then enter the following Command)-> C:\WINDOWS\Microsoft.NET\Framework\Version# aspnet_regiis -i press Enter then you get message after 3 seconds "ASP.net was installed successfully".
(*Version# will be v2.0.50727 in most cases)

Resources