简体   繁体   中英

What cause to error: Could not load file or assembly '' or one of its dependencies

I working on web project I use VS2013.In solution I have 2 projects the build platform target of all projects in solution is Any CPU .

When I start the solution at some point in Global.asax file I get this error:

Could not load file or assembly 'MapGuideDotNetApi' or one of its dependencies. An attempt was made to load a program with an incorrect format.

While all DLL's and dependencies are in bin folder.

If in visual studio I check option in tools->Options->Projects and Solutions->Web Projects-> Use the 64 bit version of IIS I don't get any error.

My question is any idea why I get the error above?

Please check your web.config, it should contain the assembly in runtime xml node

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration> 
<!--whatever goes here-->
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MapGuideDotNetApi" publicKeyToken="some token" />
        <bindingRedirect oldVersion="some old version" newVersion="some new version" />
      </dependentAssembly>
      <!--other assemblies-->
    </assemblyBinding>
    <!--whatever-->
</runtime>
<!--whatever goes here-->
</configuration>

To let the assembly appear here, I would recommend to remove and add reference which is broken.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM