请发布您的处理程序代码和您的配置文件。
MapRequestHandler - MapRequestHandler event 被 ASP.NET 基础结构用于确定
基于所请求资源的文件扩展名的当前请求的请求处理程序。 MapRequestHandler 是处理程序需要实现的event,我怀疑它卡在某个映射某个自定义文件的委托上。
我怀疑它的 1) 找不到,循环查找该自定义文件处理程序,您可能不会 2) 使用 async handler
你必须追查使用这个event的各种delegate并设置一个断点
确保它们是 Async 和 Registered,例如
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory" />
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler" />
<add verb="*" path="*.asmx" type="System.Web.Services.Protocols.WebServiceHandlerFactory" />
然后在handlers下验证
<httpHandlers>
<add verb="*" path="*.MyCustomaspx" type="MyCustomHTTPhandler"/>
</httpHandlers>
在您的实现中使用async 版本基础处理程序
// dervie from Async HttpTaskAsyncHandler
public class MyCustomHTTPhandler: HttpTaskAsyncHandler {
public override Task ProcessRequestAsync(HttpContext context)
{
//throw new NotImplementedException();
//blah blah.. some code
}
}
不得已,不推荐 - 来自SO here,如果您的处理程序/页面不修改会话变量,您可以跳过会话锁定。
<% @Page EnableSessionState="ReadOnly" %>
如果您的页面没有读取任何会话变量,您可以为该页面选择完全退出此锁定。
<% @Page EnableSessionState="False" %>
如果您的页面都没有使用会话变量,只需在 web.config 中关闭会话状态即可。
<sessionState mode="Off" />
如果您想仅根据您的特定页面/处理程序自定义会话状态,则基于此
using System;
using System.Web;
public class CustomSessionStateModule : IHttpModule
{
public void Dispose(){ //.. }
public void Init(HttpApplication context){
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e){
HttpContext currentContext = (sender as HttpApplication).Context;
// here you can filter and turn off/on the session state
if (!currentContext.Request.Url.ToString().Contains("My Custom Handler or Page Value")){
// for e.g. change it to read only
currentContext.SetSessionStateBehavior(
System.Web.SessionState.SessionStateBehavior.ReadOnly);
}
else {
//set it back to default
currentContext.SetSessionStateBehavior(
System.Web.SessionState.SessionStateBehavior.Default);
}
}
}