执行以下子项请求时出错 [英] Error executing child request for

查看:222
本文介绍了执行以下子项请求时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MVC3应用程序中,当我尝试处理超出最大请求数的错误时,出现上述错误。

In my MVC3 application I'm getting the above mention error when I try to handle a maximum request exceeded error.

我正在应用程序级别处理异常。我正在尝试重定向到位于视图的共享文件夹中的错误页面。

I'm handling the exception at the application level. I'm trying to redirect to an error page that's located in the Shared folder of the views.

如果请求大小超出限制,我正在使用下面的代码重定向到错误页面。

I'm using the code below to redirect to an error page if the request size is over the limit.

 this.Server.ClearError();
 this.Server.Transfer("~/Views/Shared/NotAuthorised.cshtml");

这是即时消息。


对/SiteName/Views/Shared/NotAuthorised.cshtml


推荐答案

根据Microsoft文档(当您在ASP.NET页中使用Server.Transfer或Server.Execute时出现错误执行子请求错误消息。)您不能在应用程序级别后使用 Server.Transfer 错误。

According to the Microsoft documentation (Error Executing Child Request" Error Message When You Use Server.Transfer or Server.Execute in ASP.NET Page) you cannot use Server.Transfer after an application level error.


Microsoft Internet信息服务(IIS)将
Server.Transfer或Server.Execute请求分派到适当的
基于请求文件扩展名的Internet服务器应用程序编程接口(ISAPI)扩展名
,例如,针对.aspx页的请求
被分派到Aspnet_isapi.dll ISAPI
扩展名。

Microsoft Internet Information Services (IIS) dispatches the Server.Transfer or the Server.Execute request to the appropriate Internet Server Application Programming Interface (ISAPI) extension based on the extension of the requesting file. For example, a request for an .aspx page is dispatched to the Aspnet_isapi.dll ISAPI extension.

之后如果请求被分派到适当的ISAPI扩展,则
ISAPI扩展不能调用另一个ISAPI扩展。您收到症状部分中列出的
错误消息,因为
Aspnet_isapi.dll文件(用于处理对ASP.NET页的请求)不能
将请求转发给Asp。 dll文件,该文件处理对ASP
页面的请求。

After the request is dispatched to appropriate ISAPI extension, the ISAPI extension cannot call another ISAPI extension. You receive the error message that is listed in the "Symptoms" section because the Aspnet_isapi.dll file, which handles requests to ASP.NET pages, cannot forward the request to the Asp.dll file, which handles requests to ASP pages.

但是您可以使用 Response.Redirect (路径)像这样:

You can however use Response.Redirect(path) like this:

Response.Redirect("Home/About");

这篇关于执行以下子项请求时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆