分享

Error message when you visit a Web site that is hosted on IIS 7.0:

 icecity1306 2014-12-22
Collapse image

Symptoms

You have a Web site that is hosted on Internet Information Services (IIS) 7.0 or 7.5. When you browse to dynamic content in the Web site by using a Web browser, you may receive an error message that resembles the following:
 
Server Error
-------------------------------------------------------------------------------------------------
Error Summary
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Detailed Error Information:

Module StaticFileModule 
Notification ExecuteRequestHandler 
Handler StaticFile 
Error Code 0x80070032
 
Requested URL http://iisserver:80/page.aspx 
Physical Path C:\inetpub\wwwroot\page.aspx 
Logon Method Anonymous 
Logon User Anonymous
 

Collapse imageCause

This error occurs because the HTTP Handler configured to handle the request has certain preconditions set, but its Application pool does not meet some or all of these preconditions.  This causes the static file handler to be used to process the request instead.  The processing of the request then fails and the 404.17 status returned because the request is for a dynamic resource and not a static one.

For example, consider the following handler mapping:

 

<add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />

 

In this case, a 404.17 error is returned if the *.aspx resource being requested from the site is handled in an Application pool that is not running in Classic Mode, is not 32 bit, or is not running the 2.0 version of the .NET Framework.   In order for the resource to be served correctly in this example, all 3 pre-conditions must be met.  Specifically, the application pool hosting this resource would have to be configured for Classic Mode, it would need to be configured to use the 2.0 version of the .NET Framework, and it would need to be set for 32 bit applications.

 

Collapse imageResolution

To resolve this issue, configure the Application Pool hosting the application to meet all of the pre-conditions set for the Handler.

  1. Open the IIS Manager
  2. Expand the computer name and click "Application Pools" in the left pane.
  3. Highlight the Application Pool hosting the resource in the middle pane.
  4. In the far right pane click "Advanced Settings..."
  5. In the Advanced settings dialog under the category "(General)", configure the following settings to match the handler requirements:
    • .NET Framework Version
    • Enable 32-Bit Applications
    • Managed Pipeline Mode

 

 

Collapse imageMore Information

The information in this section is meant to help identify which handlers are configured for the web site and application mentioned in the error, as well as help identify the pre-conditions that are configured for that handler. 

 

Appcmd.exe Commands

The following commands can be used to identify the handlers configured for the Web Site listed in the output of the error. 

 

List Application Pool  

The following commands show how to determine what application pool the application is running in, and then list the preconditions configured for that application pool.

C:\Windows\System32\inetsrv>appcmd.exe list apps /site.name:"Default Web Site"
APP "Default Web Site/" (applicationPool:DefaultAppPool)

C:\Windows\System32\inetsrv>appcmd.exe list apppools
APPPOOL "DefaultAppPool" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)


List Handlers

This command will output the handlers configured for the specific application in the default web site.

C:\Windows\System32\inetsrv>appcmd.exe list config "Default Web Site/application" -section:handlers

<system.webServer>
  <handlers accessPolicy="Read, Script">
    <add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
    <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
  </handlers>
</system.webServer>

In the case of ASP.NET there may be many handlers configured for a *.aspx resource.  In some cases, the handler may just need to be changed to match the application pool the application is running in.  Below is a list of the different ASP.NET 2.0 Handlers with their various pre-condition settings. 

 

ASP.NET 2.0 Integrated Mode 32/64-bit Handler

<add name="PageHandlerFactory-Integrated" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" />

 

ASP.NET 2.0 Classic Mode 32-bit Handler

<add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />

 

ASP.NET 2.0 Classic Mode 64-bit Handler

<add name="PageHandlerFactory-ISAPI-2.0-64" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多