Desktop client and web services - Object reference not set to an instance of an object

  • Thread starter Thread starter Ruslan
  • Start date Start date
R

Ruslan

Hello,



I have a desktop client application which calls web services. The
application works perfectly. But if I leave application intact about 30
minutes, and after a call a web method an exception is thrown which said:
"Object reference not set to an instance of an object".





Does anyone get this error?





Thanks,

Ruslan
 
Ruslan,

Interesting, are you instancing the object every time new or do you have it
placed somewhere global and instanced it only at the start of the program?

Cor
 
Every time the object is instanced. I have a lot of web methods, more than
100. After about 30 minutes of leaving application intact no one works. The
interesting think is that, this exception appears not at the all computers.
At some computer appear at others not. I checked the IIS, all the options
are the same.
 
Is it possible that the particular client has different proxy settings than
other clients? If so, the proxy server may be dropping the connection after
the time expires. I haven't run into this exactly, but my guess is that you
can reset the proxy connection by creating a new WebProxy object and use the
following code:

WebProxy proxyObject = new WebProxy("http://proxyserver:80/",true);
GlobalProxySelection.Select = proxyObject;

This should set the new proxy object to be used for all HTTPRequest calls.

I do not know for certain if this will work, so post back if it does... it
would be interesting to know.

Hope this helps,
--- Nick
 
Back
Top