Since the most recent application pool on the corporate server needs to be upgraded to the 4.0 framework, of course, 4.0 will certainly use Integrated mode deployment. There have been a lot of problems during the upgrade process, and several have been mentioned in the previous article. This time, we mainly introduce the difference between HttpHandler and HttpModule in integration and Classic mode. Many file uploads and so on need to use to HttpModule to implement. I'm going to be here today. Neatupload An error occurred under iis7.5 that the object was not referenced to the design instance. So use HttpModule as a test case.
- New test Site WebApplication, join the Myhttpmodule class implementation IHttpModule interface, the main purpose is to test whether the program has been HttpModule, through the page output HttpModule characters.+ View Code?
12345678910111213141516171819 |
public class MyHttpModule : IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.BeginRequest += context_BeginRequest;
}
protected void context_BeginRequest(
object sender, EventArgs e)
{
var context = sender
as HttpApplication;
context.Response.Clear();
context.Response.Write(
"HttpModule"
);
context.Response.End();
}
}
|
- In the IIS7.5 deployment site, first use the Classic mode application pool. Sub-nodes in <system.web> of Web. config + View Code?
12345678910 |
<remove verb=
"*" path=
"*.asmx"
/>
<add verb=
"*" path=
"*.asmx" validate=
"false" type=
"System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/>
<add verb=
"*" path=
"*_AppService.axd" validate=
"false" type=
"System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/>
<add verb=
"GET,HEAD" path=
"ScriptResource.axd" type=
"System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate=
"false"
/>
<add name=
"MyHttpModule" type=
"WebApplication.MyHttpModule, WebApplication"
/>
<add name=
"ScriptModule" type=
"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/>
|
Visit the site can find the page output is as follows, the program has been HttpModule
- Switching the application pool into integrated mode directly reveals that the page output is empty. The certification program has not been httpmodule. How can HttpModule be executed in Integrated mode? Previously deployedUrlrewriter the time to check the information only know the need <system.webServer> <modules> register HttpModule. A closer look at the configuration file will reveal a paragraph of the following English. The meaning is probably the IIS7 version of the setup. Previous versions do not need to be set.
<!--
The system.webserver section was required for running ASP. AJAX under Internet
Information Services 7.0. It is not a necessary for previous version of IIS.
-
It's probably clear that after iis7.0, some web configurations are moved to system.webserver. See the relevant Get answers Yes so detailed information on http://www.cnblogs.com/buaaboyi/archive/2011/01/20/1939903.html
So in <system.webServer> <modules> add configuration as follows, refresh the page, the page can output character HttpModule, proved successful.
?
<system.webServer>
<validation validateIntegratedModeConfiguration=
"false"
/>
<modules>
<remove name=
"ScriptModule" />
<add name=
"MyHttpModule" type=
"WebApplication.MyHttpModule, WebApplication"
/>
<add name=
"ScriptModule" preCondition=
"managedHandler" type=
"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/>
</modules>
|
HTTP Error 500.22-internal Server error detects an ASP. NET setting that is not applicable in integrated managed pipeline mode because there is a site in the upgrade process
At that time, in a more urgent situation, the <system.web> 's sub-nodes
After this today's toss is finally to iis7.5 on the deployment has a certain understanding.
Reference: http://www.cnblogs.com/buaaboyi/archive/2011/01/20/1939903.html
IIS7.5 the difference between the application pool integration mode and the Classic mode "Go"