Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Express - 500.19 Cannot read configuration file - because it's looking at the wrong path

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?

like image 614
Vitani Avatar asked Oct 22 '15 08:10

Vitani


People also ask

How do I fix 500.19 error in IIS?

The error message itself points out the location of the duplicate entries. To resolve this problem, delete the duplicate entry in the ApplicationHost. config file for the authorization rule.

Where is the ApplicationHost config file located?

The applicationHost. config file is typically located at C:\Windows\System32\inetsrv\config.

What is ApplicationHost config file?

ApplicationHost. config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings (similar to machine.


2 Answers

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).
like image 190
Sonic Soul Avatar answered Sep 17 '22 13:09

Sonic Soul


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.

like image 26
Vitani Avatar answered Sep 19 '22 13:09

Vitani