2013-11-20 158 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" /> 
    ... 

這做到了:-)