FileLoadException was unhandled by user code

后端 未结 4 1389
无人共我
无人共我 2021-01-02 23:52

I am setting up the API for my MVC-4 app and when I uncommented this line in Globals.asax.cs:

WebApiConfig.Register(GlobalConfiguration.Configuration);
         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 00:23

    This also occured to me today. Seems like there had been an update for json.net (now version 6.0.3), causing nuget to download the latest version after build. However references to old json.net libs might not get updated when there are depencies to other libs.

    Solution: Manually open the manage nuget packages for solution window and uninstall old version(s) of json.net. Then take the latest version and install for all needed projects. That fixed the exact error you had for me...

    -- edit --
    Ok, so I found out that this solution worked for me locally, but remotely this did not solve my issues. Seems like there are some old dependencies from other libs hard referencing the 4.5.0.0 version of json.net. More topics on Stackoverflow.com provide the following solution.

    Add this assembly binding redirect to your web.config file:

    
        
            
                
                    
                    
                
            
        
    
    

提交回复
热议问题