我有一个包含一些 C# 代码的 WCF 服务,它引用了一个 C++/CLI dll ,该dll又引用了一些本地 DLL 。我将所有必要的 DLL 放在我的 IIS 应用程序的 bin 文件夹中,但当 IIS 加载托管的 DLL 时,它似乎将它们复制到一个深目录中,例如:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\testwcf\73473be6\e625098c\assembly\dl3\aada7c33\85a7332b_2f9acc01
它会将每个托管的DLL复制到自己的目录并加载它。当它到达我的C++/CLI DLL时,它将其复制到类似上面的目录中,然后无法加载其依赖项。如果我手动将所有本机DLL复制到此文件夹中,它就可以运行,但这不是一个很好的解决方案。我的web.config是由VS创建的默认配置文件,其中定义了一个基于MSDN文章的端点。
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="WcfService.Service1">
<endpoint address=""
binding="wsHttpBinding"
contract="WcfService.IService1" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
如何使这些DLL自动被加载?