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" />
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
</application>
...
</site>
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?
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.
You don't say how you run IIS Express. If you run it from command line then you can try a workaround with creating and environment variable which you can use in physicalPath
.
For example if you have two files: run_on_iisexpress.ps1 and run_on_iisexpress_applicationhost.config in one directory. In run_on_iisexpress.ps1 script that runs IIS you can create an environment variable with absolute url.
run_on_iisexpress.ps1
$applicationhostConfig = "$PSScriptRoot\run_on_iisexpress_applicationhost.config"
$env:MY_WEBSITE_PATH = $PSScriptRoot; #or any other logic to generate absolute path from relative path (Resolve-Path command is usefull here)
&"C:\Program Files\IIS Express\iisexpress.exe" /config:"$applicationhostConfig" /site:"MyWebsite" /apppool:"Clr4IntegratedAppPool"
run_on_iisexpress_applicationhost.config
...
<site name="MyWebsite" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="%MY_WEBSITE_PATH%" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:60001:localhost" />
</bindings>
</site>
...
User contributions licensed under CC BY-SA 3.0