配置完IIS,运行项目时,出现"若要针对 .NET Framework 4.0 或更高版本进行编译,则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。若要针对 .NET Framework 3.5 或更低版本编译此 Web 应用程序,则请从 Web.config 文件的 <compilation> 元素中移除 targetFramework 特性。"错误。
从网上了解到可以通过把webform中configuration里面的“compilerVersion”更高为4.0或更高版本
<!--<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.8" />
<providerOption name="WarnAsError" value="false" />
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.8" />
<providerOption name="OptionInfer" value="true" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>-->
但是改成4.8后不报上述问题了,又出现“未找到编译器可执行文件 csc.exe。
”错误,后来直接把上述代码屏蔽掉就可以了。