A solution that ASP.NET is not available in the context of IIS7

  • 2020-05-12 02:28:38
  • OfStack

It has been several months since Johnny was replaced with Win7, but the system was reinstalled a few days ago, and Win7 is still used. However, after opening the VS2009 project today, when testing in IE, when opening 1, there was a mistake as follows:
The request is not available in this context
Note: an unhandled exception occurred during the execution of the current Web request. Check the stack trace information for more information about this error and the source of the error in the code.
Exception details: System.Web.HttpException: the request is not available in this context
Sources of error:
 
 line  28: protected void Application_Start(Object sender, EventArgs e) 
 line  29: { 
 line  30: ApplicationConfiguration.OnApplicationStart(Context.Server.MapPath( Context.Request.ApplicationPath )); 
 line  31: 
 line  32: } 

This is really strange, recall 1, the beginning of the use of Win7 seems to have encountered this problem, just forget how to solve it at that time. It is certain that this is not related to the project itself, because it is normal before the reinstallation, that is to say, it is related to the environment, which should be the problem of IIS7.

The good search engine is to create a lazy person, encounter a problem, is not "baidu 1 you don't know", but Google1 you will know, so or on Google to find 1, really with my judgment is correct, quote zhou xingxing said "I'm a fucking genius". The problem is simply the result of an Web application pool configuration error that should be unique to IIS7.

Solutions:

In IIS7 - > Current application virtual directory - > Right click - > Manage the application - > Advanced Settings

Modify the application pool property: DefaultAppPool is Classic.NET AppPool (classic).

Or go directly to the application pool, double-click DefaultAppPool, change "managed pipeline mode" to classic in the popup window, and make sure to exit.
Tis:
In IIS 7, application pools run in two modes: integration mode and classic mode. The application pool pattern affects how the server handles requests for managed code. If the managed application is running in a pool of applications in integration mode, the server will process the requests using the integrated request processing pipelines of IIS and ASP.NET. However, if the managed application is running in a classic application pool, the server will continue to route managed code requests through Aspnet_isapi.dll, processing the requests as if the application was running 1 in IIS 6.0.

For more on the integration pattern in the managed pipe pattern for the IIS 7 application pool, go here for 1.


Related articles: