ASP.NET application fails to load unmanaged DLL'sUnmanaged DLLs fail to load on ASP.NET serverCould not load file or assembly Temporary ASP.NET Files.Net Assembly Binding Redirect with Differing Public Key TokensReflecting assemblies in IIS7InvalidCastException is thrown after installing ASP.NET MVC 4 BetaUpgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4Could not load file or assembly 'AxInterop.WMPLib' or one of its dependencies. The parameter is incorrect.[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSectionUsing Rotativa results in a 'Could not load file or assembly' error“The located assembly's manifest definition does not match the assembly reference”Nuget package didnot load correctly (VS 2015)I have suddenly ran into Could not load file or assembly 'System.IdentityModel

1991 (I think) Trek 850 MTB bottom bracket replacement. Maybe similar to 830?

Why would anyone even use a Portkey?

What is the Japanese name for the conventional shoelace knot?

On what to compliment someone with anorexia in order to improve their body image?

"I am [the / an] owner of a bookstore"?

What election rules and voting rights are guaranteed by the US Constitution?

Bin Packing with Relational Penalization

What happens if a caster is surprised while casting a spell with a long casting time?

Checkmate in 1 on a Tangled Board

Translation of the Sator Square

How did they film the Invisible Man being invisible, in 1933?

Discworld quote about an "old couple" who having said everything to each other, can finally go about living their lives

If two black hole event horizons overlap (touch) can they ever separate again?

Converting Geographic Coordinates into Lambert2008 coordinates

What verb for taking advantage fits in "I don't want to ________ on the friendship"?

Losing the queen and then winning the game

When was this photo of Mission Dolores *actually* taken?

Are Valenar elves and Aereni elves different races of elves?

Making a wall made from glass bricks

Sentence editor

How to stop the sales department from selling functionalities that don't exist

How to securely dispose of a smartphone?

A quine of sorts

Who voices the character "Finger" in The Fifth Element?



ASP.NET application fails to load unmanaged DLL's


Unmanaged DLLs fail to load on ASP.NET serverCould not load file or assembly Temporary ASP.NET Files.Net Assembly Binding Redirect with Differing Public Key TokensReflecting assemblies in IIS7InvalidCastException is thrown after installing ASP.NET MVC 4 BetaUpgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4Could not load file or assembly 'AxInterop.WMPLib' or one of its dependencies. The parameter is incorrect.[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSectionUsing Rotativa results in a 'Could not load file or assembly' error“The located assembly's manifest definition does not match the assembly reference”Nuget package didnot load correctly (VS 2015)I have suddenly ran into Could not load file or assembly 'System.IdentityModel






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am building an ASP.NET application which references some VMware unmanaged DLL's. The dependencies look something like this:



My Application
|__VMware.VimAutomation.HorizonView.Interop.DLL (unmanaged DLL)
|__VMware.VimAutomation.HorizonView.Impl.DLL (unmanaged DLL)


When I run my test code in a console app, everything works fine.



However when I run my ASP.NET version of the app, I receive the following error message:



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

Stack Trace:


[FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +172
System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence) +53
System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) +29
System.Activator.CreateInstanceFrom(String assemblyFile, String typeName) +52
VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory..cctor() +148

[TypeInitializationException: The type initializer for 'VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory' threw an exception.]
VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.RegisterClientServer(ViewServerClient client, ViewServerInterop server) +69
VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.UpdateClient(ViewServerClient client, String domain, HviClientImpl hviClientImpl) +228
VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.ConnectViewServer(String server, String username, SecureString password, String domain) +257
WebApplication17.Controllers.HomeController.Index() in C:UsersjdavissourcereposWebApplication17WebApplication17ControllersHomeController.cs:34
lambda_method(Closure , ControllerBase , Object[] ) +87
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +77
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +72
System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +50
System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


Web.config file:



<?xml version="1.0"?>

<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="WebApplication17" />
</namespaces>
</pages>
</system.web.webPages.razor>

<appSettings>
<!--<add key="webpages:Enabled" value="false" />-->
</appSettings>

<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>

<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
</configuration>


It's clear that VMware.VimAutomation.Sdk.Impl.dll is not being copied into that temporary directory. And even if I manually copy it and try to re-run the code, the error message persists.



I've reviewed and tried every answer in the following related questions:



Could not load file or assembly Temporary ASP.NET Files



Unmanaged DLLs fail to load on ASP.NET server



If anyone can share some ideas for troubleshooting this, it would be appreciated.










share|improve this question






























    1















    I am building an ASP.NET application which references some VMware unmanaged DLL's. The dependencies look something like this:



    My Application
    |__VMware.VimAutomation.HorizonView.Interop.DLL (unmanaged DLL)
    |__VMware.VimAutomation.HorizonView.Impl.DLL (unmanaged DLL)


    When I run my test code in a console app, everything works fine.



    However when I run my ASP.NET version of the app, I receive the following error message:



    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' could not be loaded.


    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

    Stack Trace:


    [FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.]
    System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
    System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +172
    System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence) +53
    System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) +29
    System.Activator.CreateInstanceFrom(String assemblyFile, String typeName) +52
    VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory..cctor() +148

    [TypeInitializationException: The type initializer for 'VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory' threw an exception.]
    VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.RegisterClientServer(ViewServerClient client, ViewServerInterop server) +69
    VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.UpdateClient(ViewServerClient client, String domain, HviClientImpl hviClientImpl) +228
    VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.ConnectViewServer(String server, String username, SecureString password, String domain) +257
    WebApplication17.Controllers.HomeController.Index() in C:UsersjdavissourcereposWebApplication17WebApplication17ControllersHomeController.cs:34
    lambda_method(Closure , ControllerBase , Object[] ) +87
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
    System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
    System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +77
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
    System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +72
    System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
    System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +50
    System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
    System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
    System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
    System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


    Web.config file:



    <?xml version="1.0"?>

    <configuration>
    <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
    </configSections>

    <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
    <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="WebApplication17" />
    </namespaces>
    </pages>
    </system.web.webPages.razor>

    <appSettings>
    <!--<add key="webpages:Enabled" value="false" />-->
    </appSettings>

    <system.webServer>
    <handlers>
    <remove name="BlockViewHandler"/>
    <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
    </system.webServer>

    <system.web>
    <compilation>
    <assemblies>
    <add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </assemblies>
    </compilation>
    </system.web>
    </configuration>


    It's clear that VMware.VimAutomation.Sdk.Impl.dll is not being copied into that temporary directory. And even if I manually copy it and try to re-run the code, the error message persists.



    I've reviewed and tried every answer in the following related questions:



    Could not load file or assembly Temporary ASP.NET Files



    Unmanaged DLLs fail to load on ASP.NET server



    If anyone can share some ideas for troubleshooting this, it would be appreciated.










    share|improve this question


























      1












      1








      1








      I am building an ASP.NET application which references some VMware unmanaged DLL's. The dependencies look something like this:



      My Application
      |__VMware.VimAutomation.HorizonView.Interop.DLL (unmanaged DLL)
      |__VMware.VimAutomation.HorizonView.Impl.DLL (unmanaged DLL)


      When I run my test code in a console app, everything works fine.



      However when I run my ASP.NET version of the app, I receive the following error message:



      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

      Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.

      Source Error:

      An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

      Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' could not be loaded.


      WRN: Assembly binding logging is turned OFF.
      To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
      Note: There is some performance penalty associated with assembly bind failure logging.
      To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

      Stack Trace:


      [FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.]
      System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
      System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
      System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +172
      System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence) +53
      System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) +29
      System.Activator.CreateInstanceFrom(String assemblyFile, String typeName) +52
      VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory..cctor() +148

      [TypeInitializationException: The type initializer for 'VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory' threw an exception.]
      VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.RegisterClientServer(ViewServerClient client, ViewServerInterop server) +69
      VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.UpdateClient(ViewServerClient client, String domain, HviClientImpl hviClientImpl) +228
      VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.ConnectViewServer(String server, String username, SecureString password, String domain) +257
      WebApplication17.Controllers.HomeController.Index() in C:UsersjdavissourcereposWebApplication17WebApplication17ControllersHomeController.cs:34
      lambda_method(Closure , ControllerBase , Object[] ) +87
      System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
      System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
      System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +77
      System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
      System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +72
      System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
      System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
      System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +50
      System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188
      System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
      System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
      System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
      System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
      System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
      System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
      System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
      System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
      System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
      System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
      System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
      System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


      Web.config file:



      <?xml version="1.0"?>

      <configuration>
      <configSections>
      <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      </sectionGroup>
      </configSections>

      <system.web.webPages.razor>
      <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
      <add namespace="WebApplication17" />
      </namespaces>
      </pages>
      </system.web.webPages.razor>

      <appSettings>
      <!--<add key="webpages:Enabled" value="false" />-->
      </appSettings>

      <system.webServer>
      <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
      </handlers>
      </system.webServer>

      <system.web>
      <compilation>
      <assemblies>
      <add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
      </compilation>
      </system.web>
      </configuration>


      It's clear that VMware.VimAutomation.Sdk.Impl.dll is not being copied into that temporary directory. And even if I manually copy it and try to re-run the code, the error message persists.



      I've reviewed and tried every answer in the following related questions:



      Could not load file or assembly Temporary ASP.NET Files



      Unmanaged DLLs fail to load on ASP.NET server



      If anyone can share some ideas for troubleshooting this, it would be appreciated.










      share|improve this question
















      I am building an ASP.NET application which references some VMware unmanaged DLL's. The dependencies look something like this:



      My Application
      |__VMware.VimAutomation.HorizonView.Interop.DLL (unmanaged DLL)
      |__VMware.VimAutomation.HorizonView.Impl.DLL (unmanaged DLL)


      When I run my test code in a console app, everything works fine.



      However when I run my ASP.NET version of the app, I receive the following error message:



      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

      Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.

      Source Error:

      An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

      Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' could not be loaded.


      WRN: Assembly binding logging is turned OFF.
      To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
      Note: There is some performance penalty associated with assembly bind failure logging.
      To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

      Stack Trace:


      [FileNotFoundException: Could not load file or assembly 'file:///C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filestest877528943f64ba7eassemblydl348cfd1a405d27b4_7c3ad201VMware.VimAutomation.Sdk.Impl.dll' or one of its dependencies. The system cannot find the file specified.]
      System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
      System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
      System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +172
      System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence) +53
      System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) +29
      System.Activator.CreateInstanceFrom(String assemblyFile, String typeName) +52
      VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory..cctor() +148

      [TypeInitializationException: The type initializer for 'VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory' threw an exception.]
      VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.RegisterClientServer(ViewServerClient client, ViewServerInterop server) +69
      VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.UpdateClient(ViewServerClient client, String domain, HviClientImpl hviClientImpl) +228
      VMware.VimAutomation.HorizonView.Impl.V1.ViewServerClientManagerImpl.ConnectViewServer(String server, String username, SecureString password, String domain) +257
      WebApplication17.Controllers.HomeController.Index() in C:UsersjdavissourcereposWebApplication17WebApplication17ControllersHomeController.cs:34
      lambda_method(Closure , ControllerBase , Object[] ) +87
      System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
      System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
      System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +77
      System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
      System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +72
      System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
      System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
      System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +50
      System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188
      System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
      System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
      System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
      System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
      System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
      System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
      System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
      System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
      System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
      System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
      System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
      System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


      Web.config file:



      <?xml version="1.0"?>

      <configuration>
      <configSections>
      <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      </sectionGroup>
      </configSections>

      <system.web.webPages.razor>
      <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
      <add namespace="WebApplication17" />
      </namespaces>
      </pages>
      </system.web.webPages.razor>

      <appSettings>
      <!--<add key="webpages:Enabled" value="false" />-->
      </appSettings>

      <system.webServer>
      <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
      </handlers>
      </system.webServer>

      <system.web>
      <compilation>
      <assemblies>
      <add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
      </compilation>
      </system.web>
      </configuration>


      It's clear that VMware.VimAutomation.Sdk.Impl.dll is not being copied into that temporary directory. And even if I manually copy it and try to re-run the code, the error message persists.



      I've reviewed and tried every answer in the following related questions:



      Could not load file or assembly Temporary ASP.NET Files



      Unmanaged DLLs fail to load on ASP.NET server



      If anyone can share some ideas for troubleshooting this, it would be appreciated.







      asp.net vmware






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 15:09







      Jason D

















      asked Mar 25 at 14:44









      Jason DJason D

      231 silver badge8 bronze badges




      231 silver badge8 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          So after a day and a half of fighting this, I found a very simple solution.



          Adding the following code to my Web.Config, solved the problem:



           <system.web>
          <hostingEnvironment shadowCopyBinAssemblies="false" />
          </system.web>


          This stopped ALL files being copied to Temporary ASP.NET Files directory, thus avoiding the missing referenced DLL issue.



          Although I cannot be sure which directory now the files are being loaded from. Possibly my project bin?






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340394%2fasp-net-application-fails-to-load-unmanaged-dlls%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            So after a day and a half of fighting this, I found a very simple solution.



            Adding the following code to my Web.Config, solved the problem:



             <system.web>
            <hostingEnvironment shadowCopyBinAssemblies="false" />
            </system.web>


            This stopped ALL files being copied to Temporary ASP.NET Files directory, thus avoiding the missing referenced DLL issue.



            Although I cannot be sure which directory now the files are being loaded from. Possibly my project bin?






            share|improve this answer



























              1














              So after a day and a half of fighting this, I found a very simple solution.



              Adding the following code to my Web.Config, solved the problem:



               <system.web>
              <hostingEnvironment shadowCopyBinAssemblies="false" />
              </system.web>


              This stopped ALL files being copied to Temporary ASP.NET Files directory, thus avoiding the missing referenced DLL issue.



              Although I cannot be sure which directory now the files are being loaded from. Possibly my project bin?






              share|improve this answer

























                1












                1








                1







                So after a day and a half of fighting this, I found a very simple solution.



                Adding the following code to my Web.Config, solved the problem:



                 <system.web>
                <hostingEnvironment shadowCopyBinAssemblies="false" />
                </system.web>


                This stopped ALL files being copied to Temporary ASP.NET Files directory, thus avoiding the missing referenced DLL issue.



                Although I cannot be sure which directory now the files are being loaded from. Possibly my project bin?






                share|improve this answer













                So after a day and a half of fighting this, I found a very simple solution.



                Adding the following code to my Web.Config, solved the problem:



                 <system.web>
                <hostingEnvironment shadowCopyBinAssemblies="false" />
                </system.web>


                This stopped ALL files being copied to Temporary ASP.NET Files directory, thus avoiding the missing referenced DLL issue.



                Although I cannot be sure which directory now the files are being loaded from. Possibly my project bin?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 18:45









                Jason DJason D

                231 silver badge8 bronze badges




                231 silver badge8 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340394%2fasp-net-application-fails-to-load-unmanaged-dlls%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현