How to set Allow Parent Paths in IIS Express Config
Asked Answered
O

4

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?

Orobanchaceous answered 22/1, 2011 at 18:37 Comment(0)
B
50

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.

Benthos answered 21/3, 2011 at 9:30 Comment(8)
Thanks! What Windows OS does your answer apply?Orobanchaceous
this was actually on windows xp but should apply anywhere as I believe this is the default install settings for iis expressBenthos
@Benthos 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 #20108576 thanks in advanceBrisson
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.Asteriated
Windows 8.1 x64 + Web Matrix. WorksSpacing
Note, that on Windows 8.1, the path is C:\Users\$your_name$\Documents\IISExpress\config.Donee
I had to: find <sectionGroup name="system.webServer">. 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.Harvell
As of VS 2015, there is now a .vs folder that contains the applicationhost.config file. gyorgybalassy.wordpress.com/2015/03/06/…Henrietta
B
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

Borderer answered 26/1, 2011 at 5:5 Comment(5)
thanks very much. I tried to find that very page but was not successful.Orobanchaceous
"Default Web Site/myapp -- where's the closing " go?Helli
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".Cum
@Eduardo, try adding /commit:apphostLejeune
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 }Wholism
D
2

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.

Deutoplasm answered 2/8, 2022 at 2:56 Comment(0)
A
1

In my case, I'm runninig iisexpress from the command-line and @Flapper's solution and a few others didn't work, then I noticed iisexpress outputs the template config path when running from the command-line:

> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:%cd% /port:8080 /clr:v2.0

Which outputs:

Copied template config file 'C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config' to 'C:\Users\rcdmk\AppData\Local\Temp\iisexpress\applicationhost20244285325599.config'
Updated configuration file 'C:\Users\rcdmk\AppData\Local\Temp\iisexpress\applicationhost20244285325599.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express

I updated that template file, located at C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config with @Flapper's config and restarted the server, then it worked.

Asteriated answered 28/4, 2024 at 5:43 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.