网上找的例子发现都是写在 system.web里面
<system.web>
<httpModules>
<add name="TestModule" type="ClassLibrary831.TestModule,ClassLibrary831"></add>
</httpModules>
<httpHandlers>
<add verb="*" path="*" type="ClassLibrary831.TestHandler,ClassLibrary831"></add>
</httpHandlers>
</system.web>
结果发现不执行
就在网上找了好久,发现.net framework 4.0 版本的程序httpHandlers是写在system.webServer里面
<system.webServer>
<modules>
<remove name="TelemetryCorrelationHttpModule"/>
<add name="TelemetryCorrelationHttpModule"
type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"
preCondition="integratedMode,managedHandler"/>
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="ClassLibrary831" verb="*" path="cc.cc" type="ClassLibrary831.TestHandler,ClassLibrary831"></add>
</handlers>
</system.webServer>
需要注意的是
在 system.webServer里面的httpHandlers,
只能写<handlers></handlers>,
并且还得有name属性