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 14:01

I got the same error on IIS 8.5 (not express)

For me it was because I had replaced the folder with a copy and renamed it while IIS was running. For some reason it kept erroring out. I had to remove the website definition from IIS and re add it to get it to work.

查看更多
女痞
3楼-- · 2019-03-11 14:04

Turns out I had to edit %USERPROFILE%\Documents\IISExpress\config\applicationhost.config in the following way -

<configuration>
  <system.applicationHost>
    <sites>
      <site name="wsBusinessLayer">
        <application path="/">
           <virtualDirectory path="/Flowers" physicalPath="D:\TFS\sys\companydomain.com\Dev\Flowers" />

I don't know how this file gets changed "properly", but editing it manually worked fine.

查看更多
聊天终结者
4楼-- · 2019-03-11 14:06

In my case, I received a new machine but when I try run the source (which is copied from old machine) got this error. Removing applicationhost.config file from .vs\config folder under the source code directory fixed the problem.

查看更多
何必那么认真
5楼-- · 2019-03-11 14:10

In my case I replace .. in my path with a normal folder path.

TL;DR

I did the "clever" trick of utilising the relative path of my script file as I did not want to hard code my folder address.

"C:\Program Files\IIS Express\iisexpress.exe" /path:"%~dp0..\Lagardsdorren\bin\Debug\netcoreapp2.2\publish" /port:44342

I knew, but it took my some time to realise, that .. is non grata in IIS(express) as it makes it possible to path yourself out of your sites home directory. In my case it didn't but I guess IIS(express) just stops anything with .. in it.

I don't know how to get back to my clever relative path, but that is for another question.

查看更多
登录 后发表回答