小编Ton*_*lly的帖子

WebC应用程序路由中的MVC3应用程序在IIS7.5中抛出HttpContext.SetSessionStateBehavior错误

我正在Web表单应用程序的子文件夹中运行混合MVC应用程序.

在VS 2010调试(Cassini)中,一切都运行良好,但是当我部署到IIS7.5时

我收到以下错误:

'HttpContext.SetSessionStateBehavior' can only be invoked before
  'HttpApplication.AcquireRequestState' event is raised.
Run Code Online (Sandbox Code Playgroud)

它在MVC应用程序子文件夹httpHandler.ProcessRequest(HttpContext.Current);default.aspx文件中的最后一行()上出错.

public void Page_Load(object sender, System.EventArgs e)
{
    string pathToRewriteTo = Request.Path.ToLowerInvariant().Replace("default.aspx", "Home/Index");

    HttpContext.Current.RewritePath(pathToRewriteTo, false);

    IHttpHandler httpHandler = new MvcHttpHandler();

    httpHandler.ProcessRequest(HttpContext.Current);
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我从MVC根文件夹手动导航到Home/Index,我可以从那里看到我的应用程序正常.

我查找了抛出的错误,我只找到处理服务器传输而不是MVC路由的答案.

我还检查IIS7.5了路由处理模块的配置,以集成模式运行的应用程序池等.

任何帮助,将不胜感激.

webforms iis-7.5 asp.net-mvc-3

5
推荐指数
1
解决办法
4682
查看次数

标签 统计

asp.net-mvc-3 ×1

iis-7.5 ×1

webforms ×1