ASP Push Notifications: limit time response

0

I'm developing a .NET application which communicate with a JS client through Event-source.

It's works pretty well but I have a problem:

If a client disconnects when the server is writing, the server keeps being stuck for 10 seconds and gives me an error at the end:

The remote host closed the connection. The error code is 0x80070079.

This error is normal and I catch it, but I would like to avoid the 10 seconds or at least limit it to 1 or 2 seconds.

My code is like this:

 if (ctx.Response.IsClientConnected)
 {
      ctx.Response.Write("data: " + e.json + "\n\n");
 }

I try with <httpRuntime executionTimeout="3"/> but it doesn't work...

Any idea?

Valentin :)

asp.net
timeout
push-notification
asked on Stack Overflow Jan 2, 2013 by ValentinH • edited Jan 2, 2013 by Rui Jarimba

1 Answer

0

I think there might be a need for a minimum timeout based on connections' unreliability.

I don't know your code logic and architecture exactly but you can convert your operations to work asynchronously.

answered on Stack Overflow Jan 2, 2013 by erichste

User contributions licensed under CC BY-SA 3.0