How to enable an ASP.Net application to run on a SharePoint virtual server

來源:互聯網
上載者:User
Form: http://support.microsoft.com/?id=828810

SUMMARY

This article describes how to configure an ASP.NET application to run on a virtual server that is running Microsoft Windows SharePoint Services or Microsoft Office SharePoint Portal Server 2003.MORE INFORMATION

To enable an ASP.NET application to run on a server that is running Windows SharePoint Services or SharePoint Portal Server 2003, configure an exclusion for the application path on the virtual server. The exclusion tells the server that is running SharePoint Portal Server 2003 not to intercept the request to access the virtual server and to let the Microsoft Internet Information Services (IIS) server to handle the request.

Note In Office SharePoint Server 2007, you do not have to configure an exclusion. However, you should create a virtual directory by using Internet Information Services Manager. Additionally, you should configure the virtual directory as an application. The application should have a corresponding Web.config file.

To create an exclusion for a part of the URL namespace of the virtual server, follow these steps:

1. Click Start, click Administrative Tools, and then click SharePoint Central Administration.
2. In the Virtual Server Configuration area, click Configure virtual server settings.
3. On the Virtual Server List tab, click the virtual server that you have to add the excluded paths to.
4. Under Virtual Server Management, click Define Managed Paths.
5. In the Add a New Path section, type the path that you want to exclude in the Path box.
6. Click Excluded Path, and then click OK.

Sometimes, you have to do more than just set the Excluded path. Some Web programs require that you modify the Web.config file for the server that is running Windows SharePoint Services or SharePoint Portal Server 2003. To modify the Web.config file, follow these steps:

1. On the server that is hosting the Web page that you want to configure, locate the path that was excluded from the steps that are earlier in this article. The path will be similar to the following:

drive:\inetpub\wwwroot\Excluded Path
2. Save a backup copy of the Web.config file as Web2.config.
3. Open the Web.config file.
4. Locate the <system.web> tag, and then add the following code under the tag:

<!-- 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" />

5. Save the Web.config file.

For additional information about how to create a Web.config file to use with ASP.NET, click the following article number to view the article in the Microsoft Knowledge Base:

815179 (http://support.microsoft.com/kb/815179/) How to create the Web.config file for an ASP.NET application
6. Install the HTTP module that is discussed in Microsoft Knowledge Base article 887289 to look for canonicalization issues with ASP.NET. After you install the module, add the module reference to your Web.config file for your ASP.NET application that resides under an excluded path of the SharePoint Portal Server 2003 virtual server.

Note The module does not have to be added to the Web.config file that SharePoint Portal Server 2003 uses at the root of the virtual server.

To add the module reference to your ASP.NET application's Web.config file, follow these steps:

a. Open the Web.config file.
b. Locate the <httpModules> entries inside the <system.web> section that you added in step 4, and then add the following code after the last entry:

<add name="ValidatePathModule" type="Microsoft.Web.ValidatePathModule, Microsoft.Web.ValidatePathModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=eba19824f86fdadd"/>

c. Save the Web.config file.

For additional information about canonicalization issues with ASP.NET, click the following article numbers to view the articles in the Microsoft Knowledge Base:

887289 (http://support.microsoft.com/kb/887289/) HTTP module to check for canonicalization issues with ASP.NET 887459 (http://support.microsoft.com/kb/887459/) How to programmatically test for canonicalization issues with ASP.NET

Note If you do not create the exclusion for the virtual server, Windows SharePoint Services or SharePoint Portal Server 2003 will return one of the following error messages when you try to visit any one of the pages that is located on the file system:

The page cannot be found
HTTP 404 - File not foundError
A Web Part on this Smartpage cannot be displayed because it is not registered on this site as a safe Web Part.
Troubleshoot issues with Microsoft SharePoint.

Note This problem occurs because all requests to access the virtual server are intercepted by Windows SharePoint Services or by SharePoint Portal Server 2003.

Add the following directives in the Web.config file of the Web application between the <system.web> tag and the </system.web> tag:

<!-- 
Clear out the WSS ASP.NET handler and specify the default ASP.NET handler for all pages. 
-->

<httpHandlers>
<clear />
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, 
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>

<!-- 
Set the trust to Full. WSS configures a very restrictive trust policy that does not 
allow ASP.NET Web application to run correctly.
-->

<trust level="Full" originUrl="" />

<!-- 
Enable the session module. This can also be enabled on the WSS Web.config, 
but is not enabled by default. If you receive the following message:
Parser Error Message: The module 'Session' is already in the application 
and cannot be added again. You can remove the following 
<httpModules></httpModules> section as session is already enabled 
on the virtual server. 
--> 

<httpModules>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</httpModules> 

<!-- Enable session state for all the pages in the Web application. --> 
<pages enableSessionState="true" enableViewState="true" 
enableViewStateMac="true" validateRequest="false" />
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.