Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly Exception from HRESULT: 0x80131040

I created my first MVC 4 project and it works perfectly on local server. But when I publish it on to local folder and upload the folder contents to hosting server. I try to run it and I get this error:

Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The system cannot find the file specified. Can any one help me please?

Web.config:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">   <dependentAssembly>     <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />   </dependentAssembly>   <dependentAssembly>     <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />   </dependentAssembly>   <dependentAssembly>     <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />     <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />   </dependentAssembly>   <dependentAssembly>     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />   </dependentAssembly>   <dependentAssembly>     <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />     <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />   </dependentAssembly>   <dependentAssembly>     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />     <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />   </dependentAssembly> </assemblyBinding> 

P.S The same project in Web Forms works on hosting server.

like image 205
levkaster Avatar asked Feb 23 '14 20:02

levkaster


People also ask

How do I fix error 0x80131040?

The mismatch is with the version of . NET Core. The workaround is to set your C# component's minimum version to Windows 10 version 1703 (Build 15063) or lower: From your C# project, go to Properties, Library, and under Targeting, set the Min version to Windows 10 Creators Update (10.0; Build 15063) or lower.

Could not load file or assembly DLL or one of its dependencies?

There are some workarounds for this issue: The dll file may not be in /bin folder. Just copy the dll file to /bin folder or set this preference Copy Local = True from Visual Studio. If the problem persists, check if the version of the assembly that is referenced is different than the version it is looking for.

Could not load file or assembly system Cannot find file specified?

For the alert error ("The system cannot find the file specified.") Right click on [Solution Program name] then select Build Dependencies> & left click on Build Customizations... then true-checkbox {MASM} then click OK button.


2 Answers

Finally found the answer!! Go to References --> right cilck on dll file that causing the problem --> select the properties --> check the version --> match the version in properties to web config

<dependentAssembly>     <assemblyIdentity name="YourDllFile" publicKeyToken="2780ccd10d57b246"               culture="neutral" />     <bindingRedirect oldVersion="0.0.0.0-YourDllFileVersion" newVersion="YourDllFileVersion" />   </dependentAssembly> 
like image 109
levkaster Avatar answered Sep 19 '22 18:09

levkaster


What worked for me immediately was:

  • I located bin folder (picture below shows).

  • moved all dll in other folder for safety.

  • then rebuild ed the project.

  • after solved the issue, deleted old dll files.

Open file location

like image 38
Nick Bullatovci Avatar answered Sep 21 '22 18:09

Nick Bullatovci