IIS Express - 500.19 Cannot read configuration fil

2019-03-11 13:12发布

I recently renamed my root TFS folder from D:\TFS\systemstfs to D:\TFS\sys because one of the project's paths was too long for Windows. Now, when I attempt to run a different project (D:\TFS\sys\companydomain.com\Dev\Flowers\wsBusinessLayer) in VS2013 using IIS Express (Project URL http://localhost:59729/Flowers/wsBusinessLayer/) I get the following error message in the browser:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Module - IIS Web Core
Notification - BeginRequest
Error Code - 0x80070003
Config Error - Cannot read configuration file
Config File - \?\D:\TFS\systemstfs\companydomain.com\Dev\Flowers\web.config
Requested URL - http://localhost:59729/Flowers/wsBusinessLayer/InformationServices.asmx
Physical Path - D:\TFS\sys\companydomain.com\Dev\Flowers\wsBusinessLayer\InformationServices.asmx

(emphasis mine, D: is the second HDD on my machine, not a network share)

It's clear to me what the problem is (the config file path is wrong) but I have no idea how to fix it. I have tried:

  • Enabling "break on CLR exceptions when thrown"
  • Re-getting the solution from TFS
  • Rebooting
  • Switching to use IIS and then back to Express
  • Googling 500.19, 0x80070003, wrong path, cannot read configuration file, and various combinations of those terms

But have had no luck. Has anyone come across this before?

10条回答
再贱就再见
2楼-- · 2019-03-11 13:54

Here is another possible solution that doesn't involve fishing for the applicationhost.config file:

  • Right click Web Project > Web > Project Url > (e.g. 'localhost:5459') and then increment the port number which will force a new entry in that file.

In my case I also needed to change authentication mode which can be done via:

  • Select Web Project > press F4 > set Windows Authentication as needed (enabled in my case).
查看更多
Animai°情兽
3楼-- · 2019-03-11 13:54

In my case, the following changes resolved this error:

Open applicationhost.config file from [SolutionFolder]>.vs[Hidden Folder] and change the value of overrideModeDefault attribute in windowsAuthentication section from Deny to Allow. As shown below.

查看更多
Viruses.
4楼-- · 2019-03-11 13:54

If you are using Local IIS Web Server, rename the custom virtual directory, save and try again. After this, you can put back the original name.

查看更多
Evening l夕情丶
5楼-- · 2019-03-11 13:55

Had the same issue today.

Change that caused the issue

Moving functionality from a separate controller to home controller. I literally moved a view and the functionality behind it from Controller'X' to HomeController

Nature of the issue

  1. Everything works fine when run via IIS express/ Visual Studio
  2. Every thing works fine when deployed locally to IIS.
  3. Hell breaks loose when deployed to the Deployment machine.
  4. Works fine if I deploy to a 'new Site' in Deployment machine's IIS.

Fix

  1. delete the Site/application pool instance from IIS.
  2. Recreate them.
  3. Deploy.
查看更多
SAY GOODBYE
6楼-- · 2019-03-11 13:56

In my case, the wrong path was recorded in a .vs folder in the zip i received from colleague. Normally, I'd get source through source repository where .vs is not checked in.

Deleting the .vs folder resolved the problem for me.

查看更多
男人必须洒脱
7楼-- · 2019-03-11 13:57

Changing the port number on my MVC project resolved my issue. I went in circles for over an hour looking for an answer. Thank you Sonic Soul.

It always amazes me when one tiny tweak can fix something horribly broken.

I incremented the port number and the error magically resolved.

Project Properties > Web > Project Url 

Using Visual Studios 2015.

查看更多
登录 后发表回答