Thursday, March 29, 2012

Server Side Time Out in c#

Hi
I have an ASP.NET site that uses web services for security. I have two
servers running the same service. Provided the servers are running I am
able to run a check script and swap servers depending on whether the
service is running properly. This works fine if just IIS has fallen
over.
The problem is that if the server is switched off, the ASP.NET code
continues to search for the server and leaves the application hanging.
Is is possible to add a timeout to the server-side code, so that after
say 5 seconds it stops searching for the server and uses the
alternative one?
Thanks
JaredI found a way to get round this. The web service has a Timeout already,
you just need to set it. I am not sure if every type of object has a
Timeout setting.
e.g.
WebService1.Security entsec = new WebService1.Security();
entsec.Timeput = 1000;
string entsecCheck = entsec.CommsCheck([password]);
This will time out after 1 second if the server is turned off.
Jared
Jared wrote:
> Hi
> I have an ASP.NET site that uses web services for security. I have two
> servers running the same service. Provided the servers are running I am
> able to run a check script and swap servers depending on whether the
> service is running properly. This works fine if just IIS has fallen
> over.
> The problem is that if the server is switched off, the ASP.NET code
> continues to search for the server and leaves the application hanging.
> Is is possible to add a timeout to the server-side code, so that after
> say 5 seconds it stops searching for the server and uses the
> alternative one?
> Thanks
> Jared

0 comments:

Post a Comment