all groups > dotnet web services > february 2008 >
You're in the

dotnet web services

group:

Issue using an unmanaged dll in a ASP.Net 2.0 Webservice


Issue using an unmanaged dll in a ASP.Net 2.0 Webservice austirob
2/26/2008 11:37:00 PM
dotnet web services: Hi,



Any help with this problem would be greatly apprecicated as it is driving me
insane.



I have an ASP.NET 2.0 Webservice running on Windows server 2003. The
webservice calls a function in a legacy (unmanaged) C++ .dll which takes an
XML string and returns an XML string. It all works rather nicely most of the
time.



However, if the service isn't used for a while, when I call the function, I
get the old "Unable to load DLL" error. If I then restart the webservice, it
starts working again.



Here is my dll import declaration:



[DllImport(@"C:\GridVersion\CLibDll.dll", CallingConvention =
CallingConvention.StdCall)]


public static extern void calculateRequestFromDotNet(StringBuilder request,
StringBuilder response);





Any ideas on how I can even begin to resolve this issue would be
really,really appreciated.



Many thanks



Rob
Re: Issue using an unmanaged dll in a ASP.Net 2.0 Webservice Tiago Halm
3/1/2008 2:02:09 AM
When you know you'll get the error (I suspect its when w3wp.exe is not
running) and before you perform the first call, make sure you run
filemon.exe and check where the native dll is being probed for when the call
is made.

Tiago Halm

[quoted text, click to view]

AddThis Social Bookmark Button