【发布时间】:2011-08-05 17:34:56
【问题描述】:
我遇到了一个奇怪的问题。我的 Web 应用程序抛出错误“要添加的值超出范围参数名称:值”。现在这不是我每次运行程序的时候。有时显示错误,有时运行没有问题(没有做任何更改)。错误下面给出的堆栈跟踪不清楚(至少对我来说)。有人遇到过这种问题吗?
错误详情
要添加的值超出范围。 参数名称:值 说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
Exception Details: System.ArgumentOutOfRangeException: Value to add was out of range.
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: Value to add was out of range.
Parameter name: value]
System.DateTime.Add(Double value, Int32 scale) +9388319
System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8837703
System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125
System.Web.Compilation.BuildManager.CompileCodeDirectories() +319
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +248
[HttpException (0x80004005): Value to add was out of range.
Parameter name: value]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +421
System.Web.Compilation.BuildManager.CallAppInitializeMethod() +31
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +605
[HttpException (0x80004005): Value to add was out of range.
Parameter name: value]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9013676
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
【问题讨论】:
-
你能复制粘贴帖子中的错误文本吗?
-
它在
DateTime.Add()行崩溃了您在代码中的什么地方使用它?也发一下 -
@Michael Sagalovich :认为截图会更详细。不管怎样,请看下面的细节:
-
@giddy :我没有在代码中的任何地方使用该语句。甚至在解决方案中进行了快速搜索,但没有这样的行。我尝试在另一台 PC 上运行该项目,它在那里工作正常。
-
@Michael Sagalovich :编辑了带有错误文本的原始帖子。
标签: c# visual-studio-2010