简体   繁体   中英

DllImport from class library or web service project

I created a console application to import "C" Dll using DllImport The "C" Dll has reference to other Dll's and Config files in same folder.

When i put all the files in bin directory of Console applicaiton it works perfect.

But when i create a Web application to consume the same it does not work. (The dll reference are fine when i set the path, but it seems the config files are not getting loaded)

I have tried below but did not help.

  1. Copy the DLL's and config files to System32.
  2. Give access permission to IIS.
  3. Disable shadow copy.

None seem to work, Any other suggestions?

I solved the issue.

I used Directory.SetCurrentDirectory(); to set the path of the dll's and config files.

if its not possible to change the current directory. Place the files in path Directory.GetCurrentDirectory();

您需要将配置移到Web应用程序的web.config文件中。这里有一些很好的建议: Web.Config中的Custom部分/集合

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