2012-08-14 61 views
0

我有一个WCF实现REST接口使用webHttpEndpoint端点。WCF PInvoke产生“访问被拒绝”

调用堆栈是这样的: 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#Library/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所需的特定权限被发现/访问?

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

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

所以它实际上找到想要的文件。

回答

0

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

+1

然后,您可能需要勾选自己的回复。 – 2012-08-15 23:22:20

+1

我不会将此归类为答案,因为它缺少帮助他人的细节。 – 2015-02-05 09:48:45