標籤:

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

SymptomsYou have a Web site that is hosted on Internet Information Services (IIS) 7.0 or 7.5. When you browse to dynamic contentin theWeb site by using aWeb browser, you may receive an error message that resembles the following:

Server Error-------------------------------------------------------------------------------------------------Error SummaryHTTP Error 404.17 - Not FoundThe requested content appears to be script and will not be served by the static file handler.Detailed Error Information:Module StaticFileModuleNotification ExecuteRequestHandlerHandler StaticFileError Code 0x80070032Requested URL http://iisserver:80/page.aspxPhysical Path C:inetpubwwwrootpage.aspxLogon Method AnonymousLogon User Anonymous

回到頂端|提供反饋

Cause

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, considerthe following handler mapping:

<add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFrameworkv2.0.50727aspnet_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 poolhosting 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 for32 bit applications.

回到頂端|提供反饋

Resolution

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:
  6. .NET Framework Version
  7. Enable 32-Bit Applications
  8. Managed Pipeline Mode

回到頂端|提供反饋

More Information

The information in this section is meant to help identify which handlers are configured for the web site and applicationmentioned in the error, as wellas 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:WindowsSystem32inetsrv>appcmd.exe list apps /site.name:"Default Web Site"APP "Default Web Site/" (applicationPool:DefaultAppPool)

C:WindowsSystem32inetsrv>appcmd.exe list apppoolsAPPPOOL "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:WindowsSystem32inetsrv>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.NETFrameworkv2.0.50727aspnet_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.0Handlers 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.NETFrameworkv2.0.50727aspnet_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.NETFramework64v2.0.50727aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />


推薦閱讀:

主機名由localhost變成bogon是怎麼回事,怎樣變回localhost這個名字?
Win7不能顯示SwitchHost界面,但是應用管理器裡面能看到SwitchHost的進程?

TAG:host |