ASP.NET 4.0 runtime error on first loading of page
I newly converted my solution to .NET Framework 4.0 After it I got very wired error. Each first load after building my app I get filenotfound开发者_StackOverflow exception. here it is:
Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified. 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.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 9: Line 10: Line 11: Line 12: Line 13:
Change in your web.config file
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="Off"/>
<authentication mode="None"/>
</system.web>
Check if every mdule that you use on web.config is version 4. I think that you have miss a version 2.0 of the System.Windows, or a similar.
Especial Check this entries.
<compilation targetFramework="4.0">
<assemblies>
It happened to me something similar. I had a reference to an assembly in the web.config file and I was missing the ddl file in the project references folder. Try reference this assembly (System.Windows). Also you can check if the referenced version of the ddl has matching version with the one specified in the web.config (Version=2.0.5.0).
Since you said you've recently converted your app to .NET 4.0, please check the .NET version of your app's Application Pool in IIS. If it's 2.0 change to 4.0. Also check if you have properly referenced all your assemblies in your server.
精彩评论