Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > "object reference not set to an instance of an object" w/ unmanaged DLL call.

Reply
Thread Tools

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

 
 
Will
Guest
Posts: n/a
 
      03-16-2005
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.

 
Reply With Quote
 
 
 
 
TechNeck
Guest
Posts: n/a
 
      03-23-2005
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


"Will" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.
>



 
Reply With Quote
 
 
 
 
Will
Guest
Posts: n/a
 
      03-23-2005
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Object reference not set to an instance of an object" Weird thing happens with reference a link nguyentrongkha@gmail.com ASP .Net 1 09-20-2007 09:46 PM
Memory Allication (Managed VC++ DLL to Unmanaged DLL) [Second Try] Weston Fryatt ASP .Net 2 01-01-2005 11:31 AM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM
Problems using a unmanaged DLL from ASP.NET Luiz Miranda ASP .Net 0 07-30-2003 07:19 PM
How to access unmanaged DLL from within ASP.NET (using VB.NET) Sacha Korell ASP .Net 0 07-25-2003 08:55 PM



Advertisments