2011-02-02 12 views
9

Bazı nedenlerleASP.NET MVC3 HttpStatusCodeResult StatusDescription - Belirtilen argüman geçerli değerler aralığının dışındaydı

new HttpStatusCodeResult(500, statusDescription);

döndürmeye çalışırken bir hata alıyorum MVC3 uygulamasında. Xzx47

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 
hatası ile esiyorsa new HttpStatusCodeResult(500, "statusDescription");

döndürmek için sonucumu değiştirirsem İyi çalışırsa, Durum Açıklaması'nda bir çeşit uzunluk kısıtlaması var mıdır?

cevap

22

Kaynağa bakıldığında, or at the documentation, 512'den fazla karakter olamaz.

+4

Bu cevaba yıllar sonra geri dönersek, bu hatanın ne kadar aptalca olduğu beni hala delirtiyor. Bunu yapmak zorunda olsalar bile, anlamlı bir hata mesajı olmadı ve bununla birleştiğinde, bir değerin çok uzun süre ayarlanması için hızlı bir şekilde başarısız olmadı. 12_ಠ –

+1

Sadece tüm WebAPI’dan geçip ReasonPhrase’ın ayarlandığı yerleri bulup 512’den az olduğundan emin olmalıyım. Haftalar süren insanlar, kayıtlardaki belirsiz hata mesajlarını karıştırdıktan sonra. – Beans

İlgili konular