"object reference not set to an instance of an object" w/ unmanaged DLL call.

W

Will

Hello,

I have an ASP.Net 1.1 web service running on a Win2K Server machine
under IIS 5.0.

Within the web service project, I have a class whose only purpose is to
define the interface to an unamanged DLL. I use the DllImport attribute
and all of the class's functions are declared public static extern.

Intermittently I am seeing an error on the call to unmanaged DLL. The
web service catchaes a NullReferenceException: "Object not set to an
instance of an object" and the web service becomes unresponsive at that
point - so much so that I am forced to restart the ASP.NET worker
process on the web server. The stack trace of the exception points back
to a call to the unamanged DLL by a web method of the web service,
which looks pretty much like this:

MyAPIClass.UnmanagedFunctionCall();

Why is it complaining that there is a null reference exception when the
line of code that is throwing it involves a static function call?

Also, restarting the ASP.NET worker process is not something I want to
continue doing. Right now, the only way I know how to do it is by
killing the process using task manager. Is there a way I can automate
this using perhaps a setting in web.config, machine.config, or
programatically?

Thanks for any help or suggestions,
Will.
 
T

TechNeck

I have run into this same error many times when building my web services,
and every time it has been a permissions issue. Try adding the ASPNET user
to the directory or control you are trying to access with your webservice.

TechNeck
 
W

Will

TechNeck,

The DLL that the web service is using is located in the WINNT\System32
folder on the system. Also, if permissions were the issue, wouldn't I
be getting the error 100% of the time?

Thanks,
Will.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top