加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

.net-4.0 – 从自定义IHttpHandler调用MvcHttpHandler.ExecuteRe

发布时间:2020-12-16 04:13:58 所属栏目:asp.Net 来源:网络整理
导读:我有一个自定义的IHttpHandler,调用MvcHttpHandler,如 this answer所述. 它在asp.net MVC2中运行良好,但在我使用IISExpress 7.5将代码迁移到MVC4之后,我开始在行上获得InvalidOperationException: httpHandler.ProcessRequest(HttpContext.Current); 有消息
我有一个自定义的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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读