2013-11-20 155 views
0

我的帐户页面(登录,注册等)正在使用根目录的Site.Master。由于父路径被默认禁用(?),我得到以下着名的错误:IIS Express启用父路径

无法使用前导..以退出顶层目录。

我发现在计算器一个非常有前景的解决方案,但对我来说

iis-express-and-classic-asp

这里是关于部分没有工作:

<system.webServer> 

    <serverRuntime /> 

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

    <caching enabled="true" enableKernelCache="true"> 
    </caching> 

    <cgi /> 

    <defaultDocument enabled="true"> 
     <files> 
      <add value="Default.htm" /> 

      ... 
      ... 
      ... 

你有什么其他的建议?我从几个小时以来一直在搜索,但找不到任何有用的东西。其实如果我为帐户页面创建一个单独的母版页,那么我不会得到任何错误,因为它不会尝试去上层目录,但我不需要任何其他母版页,并认为应该有一个更合适的解决方案。

+0

我没有使用IIS快递与传统的ASP,但在常规IIS可以很容易地启用ASP父路径(HTTP: //prashantd.wordpress.com/2010/06/22/iis-7-5-enable-parent-paths-for-asp/)。也许如果你能在常规的IIS上使用它,它可能会解决你的问题。 – erdinger

+0

是的,你甚至可以通过配置向导实现,我猜想,在最坏的情况下,我会将该网站携带到正常的常规IIS – mctuna

回答

0

Althoug它没有解决我的问题,我只是想分享正确的方式添加enableParentPaths正确的方式。

我想这下一部分,因为它不是由“位置路径=‘网站名称’”封闭,有效期为整个asp.net项目:

<system.webServer> 

<serverRuntime /> 

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

<caching enabled="true" enableKernelCache="true"> 
</caching> 

<cgi /> 

<defaultDocument enabled="true"> 
    <files> 
     <add value="Default.htm" /> 

     ... 
     ... 
     ... 

如果enableParentPaths或任何其他选项被通缉要针对特定​​的网站只是增加了,我们必须运行在命令提示符代码:

appcmd.exe set config "Website Name" -section:system.webServer/asp /enableParentPaths:"False" /commit:apphost 

因为我有点没有“位置”具体我的项目部分,这个命令添加了以下部分在我的applicationhost.config结尾。

</location> 
<location path="Medical_BootStrap"> 
    <system.webServer> 
     <asp appAllowClientDebug="true" appAllowDebugging="true" errorsToNTLog="true" enableParentPaths="true" scriptErrorSentToBrowser="true" bufferingOn="true"> 

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

我认为这对那些想要为正确的方式为必要的网站添加它会很有用。

0

我最近遇到了类似的问题,所以也许这可以帮助你。如果使用IIS Express的/path:命令行选项,它将忽略applicationhost.config中的设置。该解决方案是创建一个新的网站部分,像这样:

 <site name="YourApplication" id="12345" serverAutoStart="true"> 
      <application path="/" applicationPool="Clr2IntegratedAppPool"> 
       <virtualDirectory path="/" physicalPath="C:\Path\To\Your\Application" /> 
      </application> 
      <bindings> 
       <binding protocol="http" bindingInformation=":8080:localhost" /> 
      </bindings> 
     </site> 

然后用/site:YourApplication命令行,而不是/path:运行IIS表达。

2

我有同样的问题在的Visual Studio 2012 - 这里是我的解决方案:

<system.webServer> 
    <asp enableParentPaths="true" /> 
</system.webServer> 

被要求,但导致了错误信息HTTP/1.1新应用程序失败。 我还必须更改C:\ Users \ [用户名] \ Documents \ IISExpress \ config \ applicationhost中的overrideModeDefault。配置拒绝允许

<sectionGroup name="system.webServer"> 
    <section name="asp" overrideModeDefault="Allow" /> 
    ... 

这做到了:-)