VS2010中產生遇到的 web.config 問題

來源:互聯網
上載者:User

標籤:

1. 錯誤:無法在此路徑使用此配置節。當網站管理員使用繼承的設定檔中的  <location allowOverride="false">  鎖定對此節的訪問時會出現這種情況(1)情況一:是因為framework的設定檔不允許自訂許可權(<location  allowOverride="false">),allowOverride預設值true被更改為了false;     解決:修改為(<location  allowOverride="true">);(2)情況二:是因為主機商修改了預設的framework的設定檔,把許可權修改得過低導致的。 framework設定檔路徑:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config (注意不同版本紅色部分目錄可能不一樣)
開啟這個檔案找到下面這段   
<location allowOverride="true">             <system.web>                    <securityPolicy>                       <trustLevel name="Full" policyFile="internal"/>                       <trustLevel name="High" policyFile="web_hightrust.config"/>                 
      <trustLevel name="Medium" policyFile="web_mediumtrust.config"/>       <trustLevel name="Low" policyFile="web_lowtrust.config"/>
      <trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
    </securityPolicy>     <trust level="Full" originUrl=""/>     <identity impersonate="true"/>   </system.web> </location>

    黃色trust部分的level預設是為full,有的主機商吧這裡設定為Medium或其他,會提示不受信任的錯誤。還有一個方法就是在web.config的</system.web>上面一行加上<trust level="Full" originUrl=""/>,改好的web.congfig如下 :

<?xml version="1.0" encoding="UTF-8"?> <configuration>             ....中間部分省略             <trust level="Full" originUrl=""/>       </system.web> </configuration>

(3)自己遇到的錯誤,如下,web.config中:

<location path="." allowOverride="false" inheritInChildApplications="false">  
......省略
</location >

 

 

 

VS2010中產生遇到的 web.config 問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.