0

我目前正在一个 MVC3 站点上工作,在 IIS Express 和 VS2010 本地。该应用程序运行良好,直到 IIS Express 挂起,我不得不终止该进程。

从那时起,当我使用 IIS Express 在 VS2010 中运行该站点时,我得到了这个 YSoD:

Input string was not in a correct format. 
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.FormatException: Input string was not in a correct format.

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: 

[FormatException: Input string was not in a correct format.]
   System.VersionResult.SetFailure(ParseFailureKind failure, String argument) +9566207
   System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent) +9549261
   System.Version.TryParseVersion(String version, VersionResult& result) +135
   System.Version.Parse(String input) +68
   System.Version..ctor(String version) +23
   System.Web.Compilation.CompilationUtil.GetVersionFromVString(String version) +76
   System.Web.Compilation.CompilationUtil.CreateCodeDomProviderWithPropertyOptions(Type codeDomProviderType) +116
   System.Web.Compilation.CompilationUtil.CreateCodeDomProviderNonPublic(Type codeDomProviderType) +12
   System.Web.Compilation.AssemblyBuilder..ctor(CompilationSection compConfig, ICollection referencedAssemblies, CompilerType compilerType, String outputAssemblyName) +366
   System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() +700
   System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +40
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +9118854
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +44
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +265

[HttpException (0x80004005): Input string was not in a correct format.]
   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) +691

[HttpException (0x80004005): Input string was not in a correct format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

堆栈跟踪似乎没有指向代码问题。IIS Express 完全有可能是一个红鲱鱼,我实际上在某个地方搞砸了我的代码......但我希望堆栈跟踪/调试器能够捕捉到这一点。

有谁知道我该如何追踪这个?

提前致谢 :)

编辑

我刚刚在VS开发服务器上试了一下,报同样的错误,估计不是IIS Express吧!

编辑 2

项目版本(在 AssemblyInfo.cs 中)如下所示:

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("One_Page_Booking_Engine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("One_Page_Booking_Engine")]
[assembly: AssemblyCopyright("Copyright ©  2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("287108fb-4a0c-419f-8b35-a3bc0e2f8617")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

编辑3:

我现在尝试删除 and 的内容binobj重新启动 VS 并重新启动我的 PC。什么都没有:(我也尝试将站点发布到带有 IIS 的服务器并运行它:我得到完全相同的 YSoD!

4

1 回答 1

0

排序!

问题出在我的 web.config 中。我从 HTML5BoilerPlate 中提取了模板,最后得到了这个块:

<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v2.0"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v2.0"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>

这很好,除了当我部署它时,我将valuefrom更改v2.0v4.0. 尽管最初工作,大概是用缓存或其他东西,这就是导致它咳出毛球的原因。

我已经删除了整个compilers块,现在它工作正常!

谢谢大家的评论,大家:)

于 2012-06-20T07:59:38.000 回答