[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

Calling an unmanaged DLL from a web service.

(Chris Bardon)

7/22/2004 2:07:00 AM

I have some code in an unmanaged DLL that I want to call from a web
service. What I've done is use DLLIMPORT statements to create a
wrapper class like so:

public class Import
{
[DllImport("unmanaged.dll")] public static extern short Fn1(short
s);
}

And called it like so:

Import.Fn1(5);

I've placed the unmanaged.dll file in the path, and have used this
code in a local windows forms app with no problems. When I try to
place this same code in a web service though, I get a
System.DLLNotFoundException saying that it is unable to load the
managed DLL. I've tried placing copies of the DLL in various
locations (web service bin directory, wwwroot, etc) with no
improvements.

Thinking it might be a security problem, I tried running my windows
forms app as a different user, and confirmed that both the anonymous
web service user and the ASPNET account were able to run the program
and find the DLL. Is there another configuration issue here that I'm
missing? There should be no reason that I can't use this DLL in this
way, correct?
1 Answer

Daryl Davis

6/14/2004 7:43:00 PM

0

This appears to be a simular issue to mine. Works great except when I call
it from a WebService.
Daryl Davis
"Chris Bardon" <cmbardon@engmail.uwaterloo.ca> wrote in message
news:5c2b81.0406140612.7b94aaf5@posting.google.com...
> I have some code in an unmanaged DLL that I want to call from a web
> service. What I've done is use DLLIMPORT statements to create a
> wrapper class like so:
>
> public class Import
> {
> [DllImport("unmanaged.dll")] public static extern short Fn1(short
> s);
> }
>
> And called it like so:
>
> Import.Fn1(5);
>
> I've placed the unmanaged.dll file in the path, and have used this
> code in a local windows forms app with no problems. When I try to
> place this same code in a web service though, I get a
> System.DLLNotFoundException saying that it is unable to load the
> managed DLL. I've tried placing copies of the DLL in various
> locations (web service bin directory, wwwroot, etc) with no
> improvements.
>
> Thinking it might be a security problem, I tried running my windows
> forms app as a different user, and confirmed that both the anonymous
> web service user and the ASPNET account were able to run the program
> and find the DLL. Is there another configuration issue here that I'm
> missing? There should be no reason that I can't use this DLL in this
> way, correct?