问题
I'm building an ASP.NET MVC 2 site with Visual Studio 2010 Beta 2.
Out of nowhere none of my images or css started showing up. If I navigate directly to the resources in the browser I see this exception message:
Specified argument was out of the range of valid values. Parameter name: utcDate
Stack Trace:
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: utcDate]
System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate) +3038942
System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath) +1130 System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +347
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8683736 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Some Notes:
Already tried restarting vs 2010, closing all the webserver instances, restarting IIS.
回答1:
Fixed this by setting my computer's clock data way into the future, build the project in debug mode, and then moved the time back.
From googling around I found this is because your trying to load assemblies that were last modified in the future. Time travel coding basically.
The other problem I had was once I set the time into the future, my VS2010 evaluation period expired.
Lol, this was because of daylight savings time which I completely forgot about.
来源:https://stackoverflow.com/questions/1656487/exception-when-vs-2010-asp-net-development-server-serves-static-files