mercoledì 28 ottobre 2015

Could not load file or assembly or one of its dependencies. (Web application)

C# .NET Framework 4.5.1 - ASP.NET WebApi

In my web application, I use a .NET wrapper assembly that uses others COM libraries and when I start up the application, I receive this message error




I have copied all assemblies and the other libraries in my “bin” folder but the reason is that the COM libraries are not copied in the ASP.NET Temporary Files directory.

The solution is add this element in the web.config file.

<system.web>
    <!-- Sets a Boolean value indicating whether the assemblies of an application in the Bin directory
      are shadow copied to the application's ASP.NET Temporary Files directory. -->
    <hostingEnvironment shadowCopyBinAssemblies="false"/>
</system.web>

Kind regards!