0

我有一个使用 webHttpEndpoint 端点实现 REST 接口的 WCF。

调用堆栈是这样的:WCF 服务 >> C# 库 >> PInvoke >> C++ 库

从 Visual Studio 运行时,一切都按预期工作。部署到 IIS 时会发生以下错误:

System.DllNotFoundException: Unable to load DLL 'native.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at ...

所有 .dll 文件都在 \bin 文件夹中。

完全相同的 C# 库/PInvoke 链在同一台服务器上的 Web 窗体 ASP.NET 站点中工作。

这是 WCF 服务的 web.config:

 <system.web>
   <trust level="Full"/>
   <compilation debug="true" targetFramework="4.0" />
   <customErrors mode="Off"/>
 </system.web>

 <system.webServer>
   <modules runAllManagedModulesForAllRequests="true">
     <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   </modules>
 </system.webServer>

 <system.serviceModel>
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
   <standardEndpoints>
     <webHttpEndpoint>
       <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
     </webHttpEndpoint>
   </standardEndpoints>
</system.serviceModel>

在 WCF 环境中是否有什么特别之处,或者是否需要特定权限才能找到/访问本机 dll?

附加信息 从 /bin 中删除 native.dll 会产生:

System.DllNotFoundException: Unable to load DLL 'util32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

所以它实际上是在寻找文件。

4

1 回答 1

-1

原来这是文件上的一个简单权限问题的结果。

于 2012-08-15T23:20:11.307 回答