0

这是堆栈跟踪。

[ArgumentOutOfRangeException: Index and length must refer to a location within the     string.
Parameter name: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean  fAlwaysCopy) +10699039
System.Web.HttpApplication.HookupEventHandlersForApplicationAndModules(MethodInfo[] handlers) +312
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +107
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Index and length must refer to a location within the string.
Parameter name: length]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874568
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

除了到处抛出随机断点之外,有没有办法找出这个异常的来源?谢谢!

4

1 回答 1

1

我遇到了同样的问题并且能够解决它。

事实证明,在某个时候,我在 Global.asax.cs 中发现了一些东西。我最终将方法更改Application_ErrorApplication_(后面有一个新行,愚蠢的宽手指......)。这就是导致我出现错误的原因。将其重写为Application_Error解决了问题。

于 2014-12-04T19:52:01.970 回答