28

I'm assuming this is possible in the applicationhost.config file but I did not see a parent paths setting.

How do you allow parent paths for a specific site running under IIS Express?

AlfonsoML
  • 12,634
  • 2
  • 46
  • 53
Brian Boatright
  • 36,294
  • 34
  • 81
  • 102

3 Answers3

48

Browse to C:\Documents and Settings\$your user name$\My Documents\IISExpress\config

Open applicationHost.config

Find the <system.webServer> section

Change the <asp> section to the following… By default it only had the cache and empty limits bits but feel free to adjust any parameters you don't want.

<asp 
     enableParentPaths="true" 
     bufferingOn="true" 
     errorsToNTLog="true" 
     appAllowDebugging="true" 
     appAllowClientDebug="true" 
     scriptErrorSentToBrowser="true">

     <session allowSessionState="true" />
     <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
     <limits />
</asp>

Save and restart iis express.

Flapper
  • 2,789
  • 1
  • 21
  • 19
  • Thanks! What Windows OS does your answer apply? – Brian Boatright Mar 23 '11 at 02:07
  • this was actually on windows xp but should apply anywhere as I believe this is the default install settings for iis express – Flapper Apr 13 '11 at 07:57
  • @Flapper I know, it has been a while since you answer it but I got the same problem, changed the asp section as you said but I get still the same error, do you have any idea? you can see my question under that link http://stackoverflow.com/questions/20108076/iis-express-enabling-parent-paths thanks in advance – mctuna Nov 23 '13 at 13:06
  • You have to change the real `asp` section inside `system.webServer`, not the one in the commented section on the top of the applicationhost.config file. – Ricardo Souza May 26 '14 at 23:40
  • Windows 8.1 x64 + Web Matrix. Works – Xilmiki Jun 23 '14 at 12:13
  • Note, that on Windows 8.1, the path is `C:\Users\$your_name$\Documents\IISExpress\config`. – Filip Vondrášek Jul 29 '15 at 10:31
  • I had to: find ``. There are a bunch of elements with attribute `overrideModeDefault`. I had to change from `Deny` to `Allow` for the settings I was trying to change. – BurnsBA Jan 11 '16 at 17:38
  • 1
    As of VS 2015, there is now a .vs folder that contains the applicationhost.config file. https://gyorgybalassy.wordpress.com/2015/03/06/i-asked-for-a-vs-folder-and-the-vs-team-gave-it-to-me/ – Gabe Jan 14 '19 at 17:33
2

The following should get you going.

  • On 32bit system "%programfiles%\iis express\appcmd" set config "Default Web Site/myapp -section:asp -enableParentPaths:true

  • On 64 bit system"%programfiles(x86)%\iis express\appcmd" set config "Default Web Site/myapp -section:asp -enableParentPaths:true

Link to related IIS 7 config reference: http://www.iis.net/ConfigReference/system.webServer/asp

Jaro Dunajsky
  • 2,003
  • 14
  • 8
  • thanks very much. I tried to find that very page but was not successful. – Brian Boatright Jan 26 '11 at 14:13
  • `"Default Web Site/myapp` -- where's the closing `"` go? – sarnold Mar 27 '11 at 01:48
  • Can you be more specific. I got `Can not set attribute "enableParentPaths" to value "true".. Reason: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".` – Eduardo Molteni Apr 08 '11 at 14:48
  • 1
    @Eduardo, try adding `/commit:apphost` – Dave Cluderay Jun 24 '11 at 16:21
  • To bring it all together, execute this in PowerShell to enable parent paths for all IIS Express sites: $appcmd = 'C:\Program Files\IIS Express\appcmd.exe'; (& $appcmd list site) -replace '^[^"]+"', '' -replace '".*', '' | %{ & $appcmd set config $_ -section:asp -enableParentPaths:true /commit:apphost } – Damian Powell Mar 26 '14 at 16:24
1

If I'm not the only one still supporting .asp in 2022 AD with Visual Studio you may need to change the application.config in the hidden .vs[solution name]\config folder if the answer by @Flapper does not work.

What might be happening is that VS copies the root IIS application.config into .vs for the solution so any changes to the root would not impact an existing solution config. In my case I had to change the solution .config as well as the root IIS .config for it to work.

David Adams
  • 519
  • 6
  • 8