gpt4 book ai didi

ASP.NET MVC3 HttpStatusCodeResult StatusDescription - 指定的参数超出有效值范围

转载 作者:行者123 更新时间:2023-12-04 01:35:40 25 4
gpt4 key购买 nike

出于某种原因,我在尝试返回时遇到错误
new HttpStatusCodeResult(500, statusDescription);
在我的 MVC3 应用程序中。它因错误而爆炸

Specified argument was out of the range of valid values.
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value]
System.Web.HttpResponse.set_StatusDescription(String value) +4877926
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +785441
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.372

如果我将结果更改为返回 new HttpStatusCodeResult(500, "statusDescription");
然后它会正常工作,状态描述是否有某种长度限制?

最佳答案

看源码,or at the documentation , 不能超过 512 个字符。

关于ASP.NET MVC3 HttpStatusCodeResult StatusDescription - 指定的参数超出有效值范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4877232/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com