San
San

Reputation: 427

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?

Upvotes: 0

Views: 1144

Answers (2)

San
San

Reputation: 427

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();

Upvotes: 1

Daniel Flippance
Daniel Flippance

Reputation: 7932

You'll need to move the configuration into the web.config file for the web application There's some good advice on how to do that here: Custom section/collection in Web.Config

Upvotes: 0

Related Questions