This error indicates that the system.web.extensions section is not defined anywhere in your web.config or machine.config. However if you check the machine.config in <<Windows Directory>>\Microsoft.NET\Framework\v4.0.30319\Config\machine.config you can see this section declared.
Following things are to be taken care for your web app to use the machine config from v4.0 and not earlier versions.
-
Make sure that the Target Framework for all the projects in your solution are pointing to “.Net Framework 4”.
-
If your Web App is running on IIS make sure that the application pool is running on a .NET Framework 4 version.
-
Finally there is one more tricky part which usually is missed. Even if the error shows up after taking care of above 2 steps then open .csproj (or .vbproj for VB application) in a text editor and walkthrough to check if there is any hard coded path reference to previous versions. For example something like this
<Target Name=”AfterBuild” Condition=”’$(MvcBuildViews)’==’true’”>
<AspNetCompiler VirtualPath=”temp” ToolPath=”$(WINDIR)\Microsoft.NET\Framework\v2.0.50727” PhysicalPath=”$(ProjectDir)\..\$(ProjectName)” />
<AspNetCompiler VirtualPath=”temp” ToolPath=”$(WINDIR)\Microsoft.NET\Framework\v2.0.50727” PhysicalPath=”$(OutDir)\_PublishedWebsites\$(ProjectName)” />
</Target>
Make sure that the path is rectified to point to v4.0 directory. Even better, make it configurable so that it does not break for any v.Next versions of .NET.
本文解决了一个特定的错误,该错误提示系统.web.extensions部分在web.config或machine.config中未定义。文章详细介绍了如何确保应用程序使用正确的.NET Framework版本,包括检查目标框架设置、应用池配置以及项目文件中的硬编码路径。

被折叠的 条评论
为什么被折叠?



