简体   繁体   English

在VS 2013中从IIS Express更改为本地IIS时,WCF中的LoadLibrary失败

[英]LoadLibrary fails in WCF when changed from IIS Express to Local IIS in VS 2013

I have a WCF service with wsHttpBinding that loads a C++ dll (that has its own dependencies, like CUDA) that works great when hosted via IIS Express. 我有一个带有wsHttpBinding的WCF服务,该服务加载一个C ++ dll(具有自己的依赖项,如CUDA),当通过IIS Express托管时,它的效果很好。 When I switch it to Local IIS in the project properties the 当我在项目属性中将其切换到本地IIS时,

LoadLibrary function fails with error 126.

I have moved every dll that lives in system32 to the inetsrv (tried System32/inetsrv and sysWOW64/inetsrv) directory (I know it is not the best way, but I wanted to know if that was the issue) but that that did not fix the problem. 我已将system32中存在的所有dll移到inetsrv(尝试过System32 / inetsrv和sysWOW64 / inetsrv)目录中(我知道这不是最好的方法,但我想知道这是否是问题所在),但这并不能解决问题。

The dll I am trying to load is not in either of those directories (never has been) and I give LoadLibrary the path to the dll (ie "C:\\path\\to\\file.dll") which, like I said, works great in IIS Express but fails with error 126 in Local IIS. 我尝试加载的dll不在这两个目录中(从来没有),并且我给LoadLibrary通往dll的路径(即“ C:\\ path \\ to \\ file.dll”),就像我说的那样,在IIS Express中效果很好,但在本地IIS中失败并出现错误126。

I have made it so the Users group has full permissions of the directory containing the dll as well (as I believe the IIS Worker processes operate with Users group permissions) but that did not help me either. 我已经做到了,因此Users组对包含dll的目录也具有完全权限(因为我相信IIS Worker进程使用Users组权限运行),但这也无济于事。

Any help would be appreciated! 任何帮助,将不胜感激! If I am missing some information above let me know and I can get what is needed. 如果我缺少上面的一些信息,请告诉我,我会得到所需的信息。 Thanks! 谢谢!

I found the solution to this problem. 我找到了解决此问题的方法。 Due to the change in user (IIS app pool having LocalSystem) identity, and a dependency installed as my user (the account I log in with) I had to add the path for that dependency to the System's "path" environment variable. 由于用户(具有LocalSystem的IIS应用程序池)身份发生了更改,并且以我的用户身份(我登录时使用的帐户)安装了依赖项,因此我不得不将该依赖项的路径添加到系统的“路径”环境变量中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM