Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm configuring a site in applicationhost.config for IIS 7.5 Express:

<site name="default" id="1" serverAutoStart="true">
    <application path="/">
        <virtualDirectory path="/" physicalPath="%IIS_BIN%\..\Somewhere\Else" />
                                            <!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->

I've found that specifying relative paths as shown does not seem to work and will lead to an HTTP 500.19 Internal Server Error. IIS further reports error code 0x8007007b, which, after some googling, seems to indicate an invalid file path syntax.

Is there any way around this error, so that I can use relative physical path for my site's root?

share|improve this question
up vote 5 down vote accepted

Unfortunately no. That must be a full physical path. As long as you don't plan to change your site path often, a static path shouldn't be a problem. If you change your path often to different site instances you may want to consider using appcmd to script the change so that it gets all subfolders.

share|improve this answer
If would be nice for dev for example when branching if the Vdir could be relative to the configuration file which could be checked into source control. Any ideas on how to do this? – PilotBob Aug 27 '15 at 21:14
Relative paths aren't supported with the current versions of IIS, unfortunately, so the cleanest solution is to use the same path on each machine. If you must have different paths on different machines (I assume dev machines) then you can try an environment variable. Create a system environment variable so that it's available to IIS and use that for the root of the path on the individual systems. – Scott Forsyth - MVP Aug 28 '15 at 3:43
It seems that some environment variables are supported, though, e.g. <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />. – Uwe Keim Jan 19 at 11:53
@UweKeim You're right, this does work with the current version(s) of IIS. IIS 10 supports variables in the physicalPath now. Note that %IIS_SITES_HOME% is for IIS Express. That variable doesn't exist in the full version of IIS. However, other system variables do work. – Scott Forsyth - MVP Jan 22 at 23:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.