很多人有時都會為虛拟目錄中的web.config繼承了主目錄中的web.config而苦惱, 大部分主要是由于根目錄中的web.config添加了httphandler、 httpmodule 引起的。 其實這個問題解決起來很簡單,隻将 httphandler httpmodule的聲明添加到location中即可。
如下所示:
<configuration>
<location path="." allowOverride="true" inheritInChildApplications="false">
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
</location>
</configuration>
path 不用說指定的是一個目錄
allowOverride 指是否可以将這個重寫
inheritInChildApplications 指是否被子級應用程式繼承
我遇到的問題是主目錄中引用了DevExpress控件,結果在WebService中調用任何頁面,都提示
未能加載檔案或程式集“DevExpress.Web.ASPxGridView.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=e0b364db0ebed33f”或它的某一個依賴項。系統找不到指定的檔案
按如上的處理方法,解決了這個問題!