2012-08-14 88 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