ram*_*ram 5 asp.net iis-7 cassini httpmodule ihttpmodule
我有一个简单的HTTPModule,它可以进行一些自定义会话状态管理.
public void Init(HttpApplication context)
{
context.AcquireRequestState += new EventHandler(ProcessBeginRequest);
ActivityLogger.LogInfo( DateTime.UtcNow.ToLongTimeString() + " In Init " + HttpContext.Current.Request.Url.AbsoluteUri);
}
Run Code Online (Sandbox Code Playgroud)
和
public void ProcessBeginRequest(object sender, EventArgs e)
{
HttpApplication application = sender as HttpApplication;
ActivityLogger.LogInfo(DateTime.UtcNow.ToLongTimeString() + " In ProcessBeginRequest ");
if (application != null)
{
string requestURL = application.Context.Request.Url.ToString();
ActivityLogger.LogInfo(DateTime.UtcNow.ToLongTimeString() + " In ProcessBeginRequest " + requestURL);
}
return;
}
Run Code Online (Sandbox Code Playgroud)
当我使用断点运行此代码时,我看到即使对于静态文件(如images,js和css)也调用了此模块.有没有人经历过这个?我认为HTTP模块只是挂钩到asp.net页面的http管道中的事件.他们是否也依赖于静态资源?或者只是卡西尼?
环境:VS2008 - cassini服务器
PS:我在沙箱中尝试使用Win2k8 IIS7(有点新),并尝试将其写入日志文件(因为我们没有VS),但无法写入日志文件.我确定它的一些写权限问题.任何人都可以指向我一些资源,它告诉我如何在W2k8中运行带有IIS7的ASP.net时为目录设置写权限
Edit1:我知道使用Integrated管道可以扩展静态和托管资源的http管道 http://aspnet.4guysfromrolla.com/articles/122408-1.aspx和http://learn.iis.net/page.aspx/243/ASPNET集成与- IIS7 /
我们在生产中使用经典管道.但仍然有兴趣了解其他人的经历.
问题2:在集成模式下使用IIS7会降低性能吗?假设您有几个模块与管道连接,性能影响有多大?如果有人可以指出我做了一些基线研究,那将会很好.
ram*_*ram 14
看起来有办法做到这一点
http://learn.iis.net/page.aspx/121/iis-70-modules-overview/#Disabling
设置preCondition="managedHandler"和<modules runAllManagedModulesForAllRequests="false" />会做的伎俩
note to self: http://code.google.com/p/talifun-web/wiki/StaticFileHandler need to explore this StaticFileHandler
references:
http://learn.iis.net/page.aspx/244/how-to-take-advantage-of-the-iis7-integrated-pipeline/
Exclude HttpModule from running for static content on IIS7
http://msdn.microsoft.com/en-us/library/bya7fh0a.aspx
| 归档时间: |
|
| 查看次数: |
5881 次 |
| 最近记录: |