Failed to load file or assembly "System.Web.Mvc, Version = 3.0.0.0

I looked at similar publications, but did not find what helped fix this problem.

Just briefly, I have an mvc3 project running on azure. A couple of days ago, for some reason, he lost the link to System.Web.MVC. So I added the link and changed the Copy Local property to True. He built and ran on the local emulator in order. Then I published it and received the following message when opening the website.

"Failed to load file or assembly" System.Web.Mvc, Version = 3.0.0.0 "

It turns out that I am only version 3.0.0.1, not 3.0.0.0 specified in my web.congig file. I tried to change the value in web.config in both the assembly and runtimes to 3.0.0.1, but this throws another exception in azure (although it did not change the general token)

I also tried to add Deployable Dependency, but it did not matter, and I tried to download and add version 3.0.0.0 to the project, but vs did not like this DLL when publishing.

I also tried changing the Specifc Version property for the assembly to False, but that didn't work.

So for some reason, I no longer have v3.0.0.0, but I donโ€™t know how to change my project to use v3.0.0.1. I think.

Server error in application "/".

Configuration Error Description: An error occurred while processing the configuration file needed to service this request. Review the specific error information below and modify your configuration file accordingly.

Parser error message: Could not load file or assembly "System.Web.Mvc, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" or one of its dependencies. The located assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error: Line 39: Line 40: Line 41: Line 42: Line 43:

Source file: E: \ sitesroot \ 0 \ web.config Line: 41

Track boot assembly. The following information may be useful in determining why the assembly "System.Web.Mvc, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" cannot be loaded. WRN: Assembly binding registration is disabled. To enable assembly failure logging, set the registry value to [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD) on 1. Note. There is some performance limitation associated with the assembly binding failure protocol. To disable this feature, delete the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog].

+5
source share
3 answers

Thank you man. I actually just commented on the pipelined line of code to build mvc and changed the binding code at runtime to look for v 3.0.0.1 in web.config, and this did the trick. Iโ€™m not sure if this is the best solution, but spending more time on it was a big factor.

+4
source
  • I had a very similar error
  • My solution worked previously and nothing has changed except for some actions using source control
  • I created a completely new workspace and checked all the source code again on a new workspace, and this fixed the problem (just doing โ€œgetโ€ and โ€œGet Specific Versionโ€ was not enough)
    • It seems that something has been done to my workspace, which prevented the compiler from finding the correct .dll. Perhaps this is due to a search in the GAC?
+1
source

I had this problem in random order and now I know why. When you upgrade the nuget package and the package has the web.config as part of the nuget package, it combines the contents of the web.config in the nuget package with your configuration file. The nuget package was a private package that I created and did not understand this.

In the web.config , the package contained redirection redirects for MVC, and this leads to the fact that my configuration file suddenly has duplicate entries. I initially skipped it because it does all the binding redirects on the same line.

Once you remove the duplicate redirects, it will fix the problem. This question was a great clue for me to figure out what causes this.

+1
source

Source: https://habr.com/ru/post/1204980/


All Articles