简体   繁体   中英

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. When I switch it to Local IIS in the project properties the

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.

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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