本文將告訴您,如何設定 ASP.NET 應用程式正在執行 Microsoft Windows SharePoint 服務的虛擬伺服器或 Microsoft Office SharePoint 入口網站 Server 2003 上執行。
若要以便在執行 Windows SharePoint 服務的伺服器或 SharePoint 入口網站 Server 2003 上執行的 ASP.NET 應用程式設定 [虛擬伺服器上的 [應用程式路徑的排除]。排除告訴正在執行不以攔截要求存取虛擬伺服器,並讓 Microsoft 網際網路資訊服務 (IIS) 伺服器處理要求的 SharePoint 入口網站 Server 2003 的伺服器。
附註在 Office SharePoint Server 2007 您並沒有設定的排除。但是,您應該使用網際網路資訊服務管理員],以建立虛擬目錄。此外,您應該將虛擬目錄設定為應用程式。應用程式應該具有相對應的 Web.config 檔。
若要建立之虛擬伺服器的 URL 命名空間的部份的排除,請依照下列步驟執行:
- 按一下 [開始],按一下 [系統管理工具],然後再按一下 [SharePoint 管理中心。
- 虛擬伺服器設定 區內按一下 [設定虛擬伺服器設定]。
- 在 [虛擬伺服器清單] 索引標籤上按一下 [您必須新增已排除的路徑的虛擬伺服器]。
- 在 [虛擬伺服器管理,按一下 [定義管理的路徑。
- 新增新的路徑] 區段中輸入 [您想要排除在 [路徑] 方塊中的路徑]。
- 按一下 [排除路徑,然後按一下 [確定]。
有時,您必須執行多個只設定排除路徑。某些 Web 應用程式需要您修改 Web.config 檔案,SharePoint 入口網站伺服器 2003年或正在執行 Windows SharePoint 服務的伺服器。若要修改 Web.config 檔案,請依照下列步驟執行:
重要:這些修改是最開放且不受限制的變化。他們應該仔細評估並仔細評估在生產環境中使用它們之前。
- 裝載您想要設定的網頁伺服器上, 找出從早本文中的步驟中排除的路徑。路徑會類似下列:
drive: \inetpub\wwwroot\ Excluded Path
- 將 Web.config 檔案的備份複本儲存為 Web2.config。
- 開啟 Web.config 檔案。
- 找出 <system.web>] 標記,然後加入下列程式碼,在標記下:
<!-- Setup the PageHandlerFactory to process all requests. This will override the SharePoint HTTPHandler. -->
<httpHandlers>
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
<!-- Set the trust back to Full. WSS configures a very restrictive trust policy that does not allow most applications to run correctly. -->
<trust level="Full" originUrl="" />
<!--
Enable the modules that you must have for your program to run.
If you receive the following message:
Parser Error Message: The module '<moduleName>' is already in the program and cannot be added again
You can remove the modules that are mentioned in the error message. The SharePoint web.config already includes the module for OutputCache and WindowsAuthentication so you do not have to add them here.
-->
<httpModules>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
<add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule"/>
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"/>
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule"/>
</httpModules>
<!-- Enable Session for the pages -->
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" />
- 儲存 Web.config 檔案。
如需有關如何建立 ASP.NET 搭配使用的 Web.config 檔案的詳細資訊,按一下 [下列面的文件編號,檢視 「 Microsoft 知識庫 」 中的發行項]: 815179?
(http://support.microsoft.com/kb/815179/
)
如何建立 ASP.NET 應用程式的 Web.config 檔
- 安裝 「 Microsoft 知識庫 」 文件 887289 看起來與 ASP.NET 相關的規範化問題所提及的 HTTP 模組。將安裝模組之後模組參考加入至 ASP.NET 應用程式位於 SharePoint 入口網站 Server 2003 虛擬伺服器的排除路徑下您 Web.config 檔。
附註模組並沒有新增至 SharePoint 入口網站 Server 2003 會使用根目錄的虛擬伺服器在 Web.config 檔中。
如果要將模組參考加入至 ASP.NET 應用程式的 Web.config 檔,請依照下列步驟執行:- 開啟 Web.config 檔案。
- 您在步驟 4,加入 <system.web> 區段中找到 <httpmodules>項目,並再最後一個項目之後加入下列程式碼:
<add name="ValidatePathModule" type="Microsoft.Web.ValidatePathModule, Microsoft.Web.ValidatePathModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=eba19824f86fdadd"/>
- 儲存 Web.config 檔案。
如其他有關使用 ASP.NET 的規範化問題的資訊,按一下下面的文件編號,檢視 「 Microsoft 知識庫 」 中 「 文件: 887289?
(http://support.microsoft.com/kb/887289/
)
HTTP 模組,以檢查與 ASP.NET 相關的規範化問題
887459?
(http://support.microsoft.com/kb/887459/
)
如何以程式設計方式測試與 ASP.NET 相關的規範化問題
附註如果未建立虛擬伺服器的排除 Windows SharePoint 服務或 SharePoint 入口網站 Server 2003 會傳回下列錯誤訊息之一當您嘗試造訪任何一種頁面位於檔案系統上:
錯誤
無法顯示 [網頁組件] 這個 Smartpage,因為尚未註冊為安全的網頁組件此網站上。
疑難排解 Microsoft SharePoint 的問題。
附註 若要存取虛擬伺服器的所有要求被都攔截,由 Windows SharePoint 服務或 SharePoint 入口網站 Server 2003,就會發生這個問題。