ASP.NET: What does this HttpModule do? System.ServiceModel.Activation.HttpModule

后端 未结 3 1814
名媛妹妹
名媛妹妹 2021-01-12 02:45

Can anyone tell me the purpose of this HttpModule? It\'s showing up on my HttpModuleCollection list, but I don\'t know what\'s it\'s for.

System.ServiceMode         


        
相关标签:
3条回答
  • 2021-01-12 03:25

    System.ServiceModel.Activation.HttpModule come from because you installed "Microsoft .NET Framework 3.5.1" / "Windows Communication Foundation HTTP Activation" feature. If you don't need the feature you can uninstall it of remove the module from your web.config. The less unused modules you load the more quickly run your web application.

    If you install this feature after the installation of .NET 4 framework on your server you can receive problems described in http://blogs.iis.net/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx.

    In general an HTTP module is called on every request in response to the BeginRequest() and EndRequest() events. As a result, the module runs before and after a request is processed. In the section "How HTTP Modules Work" on http://msdn.microsoft.com/en-us/library/bb398986(v=VS.100).aspx you can read more about HTTP modules.

    http://msdn.microsoft.com/en-us/library/ms227673.aspx describes how to create a Custom HTTP Module. Some small custom modules can be really helpful. For example, you can read in How to remove the ".svc" extension in RESTful WCF service? a code example (which originate from the book "RESTful .NET", Chapter 5, page 96) "Removing the .SVC Extension from WCF REST URLs". In http://www.west-wind.com/weblog/posts/570695.aspx you can read how to do the same with respect of "IIS 7 Rewrite Module".

    The general information about HTTP module is not a part of your question, but I inserted it to better understanding what Activation.HttpModule do, and what other more useful modules you can use or write yourself.

    0 讨论(0)
  • 2021-01-12 03:37

    This module is what allows WCF (Windows Communication Foundation) services to work (starting in .net Framework 3.0).

    You can safely ignore it and it shouldn't cause trouble. If you really want to get rid of it, you can remove it from your root web.config file (e.g. in \Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config). But I suggest leaving it there just in case you need WCF at some point.

    0 讨论(0)
  • 2021-01-12 03:49

    A http module is a .net assembly that is called every time your web application gets a request. This is the standard one that asp.net provides that connects your .net web application code to the IIS web infrastructure.

    See here for an explanation.

    HTTP Modules

    An HTTP module is an assembly that is called on every request that is made to your application. HTTP modules are called as part of the request pipeline and have access to life-cycle events throughout the request. HTTP modules therefore let you examine incoming requests and take action based on the request. They also let you examine the outgoing response and modify it.

    In IIS 6.0, the ASP.NET request pipeline is separate from the Web server request pipeline. In IIS 7.0, the ASP.NET request pipeline and the Web server request pipeline can be integrated into a common request pipeline. In IIS 7.0, this is referred to as Integrated mode. The unified pipeline has several benefits for ASP.NET developers. For example, it lets managed-code modules receive pipeline notifications for all requests, even if the requests are not for ASP.NET resources. However, if you want, you can run IIS 7.0 in Classic mode, which emulates ASP.NET running in IIS 6.0. For more information, see ASP.NET Application Life Cycle Overview for IIS 7.0.

    ASP.NET HTTP modules are like ISAPI filters because they are invoked for all requests. However, they are written in managed code and are fully integrated with the life cycle of an ASP.NET application. You can put custom module source code in the App_Code folder of your application, or you can put compiled custom modules as assemblies in the Bin folder of an application.

    ASP.NET uses modules to implement various application features, which includes forms authentication, caching, session state, and client script services. In each case, when those services are enabled, the module is called as part of a request and performs tasks that are outside the scope of any single page request. Modules can consume application events and can raise events that can be handled in the Global.asax file. For more information about application events, see ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0 and ASP.NET Application Life Cycle Overview for IIS 7.0.

    0 讨论(0)
提交回复
热议问题