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

Discussion in 'ASP .Net Web Services' started by Will, Mar 16, 2005.

  1. Will

    Will Guest

    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.
     
    Will, Mar 16, 2005
    #1
    1. Advertising

  2. Will

    TechNeck Guest

    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" <> wrote in message
    news:...
    > 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.
    >
     
    TechNeck, Mar 23, 2005
    #2
    1. Advertising

  3. Will

    Will Guest

    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.
     
    Will, Mar 23, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Weston Fryatt
    Replies:
    2
    Views:
    1,035
    Weston Fryatt
    Jan 1, 2005
  2. =?Utf-8?B?UHJpeWE=?=

    call a unmanaged dll in ASP.NET app

    =?Utf-8?B?UHJpeWE=?=, Oct 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,868
    CJ Taylor
    Oct 28, 2004
  3. =?Utf-8?B?Y2hlbG9tYW4=?=

    Unmanaged dll call error from IIS asp.net site

    =?Utf-8?B?Y2hlbG9tYW4=?=, Jun 6, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    546
    =?Utf-8?B?Y2hlbG9tYW4=?=
    Jun 6, 2007
  4. Replies:
    1
    Views:
    514
    Mark Rae [MVP]
    Sep 20, 2007
  5. cheloman

    Unmanaged C dll call errors from IIS web site

    cheloman, Jun 6, 2007, in forum: ASP .Net Security
    Replies:
    0
    Views:
    143
    cheloman
    Jun 6, 2007
Loading...

Share This Page