.net-4.0 – 从自定义IHttpHandler调用MvcHttpHandler.ExecuteRequest时出错

我有一个自定义的IHttpHandler,调用MvcHttpHandler,如 this answer所述.

它在asp.net MVC2中运行良好,但在我使用IISExpress 7.5将代码迁移到MVC4之后,我开始在行上获得InvalidOperationException:

httpHandler.ProcessRequest(HttpContext.Current);

有消息:

‘HttpContext.SetSessionStateBehavior’ can only be invoked before
‘HttpApplication.AcquireRequestState’ event is raised.

ASP.NET Development Server不会出现任何问题.

有谁知道这里发生了什么,以及如何解决它?

解决方法

我相信你需要使用httpContext.Server.TransferRequest和MVC更新.

看到这个问题:MVC3 Application Inside Webforms Application Routing is throwing a HttpContext.SetSessionStateBehavior Error in IIS7.5

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....