Microsoft ASP.NET Scaling AJAX Reverse Sample "Long Poll" Codeplex

I am studying a Microsoft reverse AJAX pattern in which they use a long timeout in ScriptManager

<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="2147483647"> 

And ManualResetEvent for waiting management:

  private ManualResetEvent messageEvent = new ManualResetEvent(false); public Message DequeueMessage() { // Wait until a new message. messageEvent.WaitOne(); } public void EnqueueMessage(Message message) { lock (messageQueue) { messageQueue.Enqueue(message); // Set a new message event. messageEvent.Set(); } } 

I noticed that

  • Setting AsyncPostBackTimeout to low (5) does not result in a timeout or script error
  • <httpRuntime executionTimeout="5"/> in web.config doesn't seem to have an effect
  • The following javascript does not start if execution takes too long

      Sys.WebForms.PageRequestManager.getInstance() .add_endRequest(function (sender, args) { if (args.get_error() && args.get_error().name === 'Sys.WebForms.PageRequestManagerTimeoutException') { alert('Caught a timeout!'); // remember to set errorHandled = true to keep from getting a popup from the AJAX library itself args.set_errorHandled(true); } }); 

Makes me ask these questions

  • What are the correct IIS settings and .js callbacks that affect the execution of this code?

  • What parts of the IIS infrastructure are emphasized when scaling this application?

  • Will anything change in # 2 if it becomes a WAS-based WCF service?

+1
comet wcf reverse-ajax
source share
1 answer

The AsyncPostBackTimeout unit of value is second, so 5 means 5 seconds, of course we don't need 5 seconds to wait for the callback. The ExecutionTimeout property specifies the maximum number of seconds that a request can execute before ASP.NET automatically shuts down. The default value is 110 seconds. This timeout applies only if the debug attribute in the element is set to false.

• The following javascript does not start when execution takes too long

How could you know that execution takes too long?

1. What are the correct IIS settings and .js callbacks that affect the execution of this code?

We do not need special settings in IIS for this example. Only a network problem can cause a execution timeout.

I'm confused, why do you want to focus on the timeout, did you get an unhandled exception when using my sample?

Jerry Van - MSFT

+1
source share

All Articles