Greylander
Greylander

Reputation: 1826

visual studio putting wrong path for virutalDirectory in applicationhost.config?

I recently moved my "My Documents" folder from the C: to the D: drive. This seems to have broken my ability to debug web app in Visual Studio. I'm assuming that visual studio creates entries like the following in applicationhost.config, and I am wondering where the first physicalPath for the root virtualDirectory comes from, as I am fairly certain that is the problem (I've pretty much confirmed that VS creates an entry like the following when a solution is opened):

            <site name="My.Application-Site" id="2">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Users\myname\Documents\My Web Sites\My.Application-Site" />
            </application>
            <application path="/My" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="D:\repos\MyCheckout\My\My.Application" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:49924:localhost" />
            </bindings>
        </site>

When I try to run the app in debugger, the browser pops up with an error, the relevant bits of which are below. Notice the path to web.config still uses C:, even though it seems to know the right place for tracelogfiles:

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

Config Error       Cannot read configuration file
Config File    \\?\C:\Users\myname\Documents\My Web Sites\My.Application-Site(2)\web.config
Requested URL      http://localhost:50616/My/
Request Tracing Directory      D:\users\myname\My Documents\IISExpress\TraceLogFiles\

So the question is where in Visual Studio (or IIS) is the path for the web.config file determined, and how do I change it. And/or is there some other reason or insight anyone can provide as to why I am getting this 500.19 error?

Another recent change (other than moving My Documents) is I uninstalled a trial of VS Ultimate 2013 and installed VS Pro 2013 -- could that have somehow caused this? Both of changes have been made between the time I was last able to debug the app normally and getting this error.

Upvotes: 4

Views: 3403

Answers (1)

tacitomv
tacitomv

Reputation: 57

For someone looking for an answer to "where in Visual Studio (or IIS) is the path for the web.config file determined, and how do I change it" or "I moved my application from its origin folder"

Right-click in Project Properties > Web Tab and Create Virtual Directory buttom.

It all happened when I was developing (and debuging, of course) my application on two different machines, with different paths (and Drives) to the source code managed by git.

Hope it helps

Upvotes: 2

Related Questions