本文介绍了从自定义IHttpHandler调用MvcHttpHandler.ExecuteRequest时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义IHttpHandler,它调用如中所述实现的MvcHttpHandler。

I have a custom IHttpHandler that calls MvcHttpHandler implemented as described in this answer.

在asp.net MVC2中效果很好,但是在我使用IISExpress 7.5将代码迁移到MVC4之后,我开始在行中获取InvalidOperationException:

It worked well in asp.net MVC2, but after I migrate the code to MVC4 with IISExpress 7.5, I start getting InvalidOperationException on the line:

httpHandler.ProcessRequest(HttpContext.Current);

消息:

ASP.NET开发服务器不会出现任何问题。

ASP.NET Development Server does not make any problems.

有人知道这里发生了什么以及如何解决吗?

Does anyone know what's going on here, and how to solve it?

推荐答案

我相信您需要在MVC更新中使用 httpContext.Server.TransferRequest

I believe you need to use httpContext.Server.TransferRequest with the MVC update.

请参阅以下问题:

这篇关于从自定义IHttpHandler调用MvcHttpHandler.ExecuteRequest时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 10:15