IHttpModule配置节的问题
public class TimerModule:IHttpModule
{
public TimerModule()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void Init(HttpApplication HttpApp)
{
HttpApp.BeginRequest += new EventHandler(this.OnBeginRequest);
HttpApp.EndRequest += new EventHandler(this.OnEndRequest);
}
public void OnBeginRequest(object o,EventArgs ea)
{
HttpApplication HttpApp = o as HttpApplication;
HttpApp.Context.Items["sTime"] = DateTime.Now;
}
public void OnEndRequest(object o,EventArgs ea)
{
HttpApplication HttpApp = o as HttpApplication;
DateTime dt = (DateTime)HttpApp.Context.Items["sTime"];
TimeSpan st = DateTime.Now - dt;
HttpApp.Context.Response.AddHeader("RequestTiming",st.ToString());
}
public void Dispose(){}
}
下面是我的配置节:<httpModules>
<add name="TimerModule" type="TimerModule,TimerModule" />
</httpModules>
问题如下:
分析器错误信息: 找不到文件或程序集名称“TimerModule”,或找不到它的一个依赖项。
源错误:
行 100: </httpHandlers>
行 101: <httpModules>
行 102: <add name="TimerModule" type="TimerModule,TimerModule" />
行 103: </httpModules>
行 104:
程序集加载跟踪: 下列信息有助于确定程序集“TimerModule”无法加载的原因。
=== Pre-bind state information ===
LOG: DisplayName = TimerModule
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/studyApplication1
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: TimerModule
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/studyapplication1/b4526b3c/5d58f7c7/TimerModule.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/studyapplication1/b4526b3c/5d58f7c7/TimerModule/TimerModule.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/studyApplication1/bin/TimerModule.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/studyApplication1/bin/TimerModule/TimerModule.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/studyapplication1/b4526b3c/5d58f7c7/TimerModule.EXE.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/studyapplication1/b4526b3c/5d58f7c7/TimerModule/TimerModule.EXE.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/studyApplication1/bin/TimerModule.EXE.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/studyApplication1/bin/TimerModule/TimerModule.EXE.