Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax post back causing all other web requests to hang until the method request finishes
    text
    copied!<p><strong>Edit</strong></p> <p>Ok thats typical, I figure out a possible solution to the problem just after I ask for help!</p> <p>My code is now using Threading to spawn a new thread to perform the indexing independently from the current request. It seems to be working.</p> <p>The code that I came up with:</p> <pre><code>private static WebDocument Document; private static readonly object Locker = new object(); [WebMethod(true)] public static string Index(string uri) { WebDocument document = WebDocument.Get(uri); if (document == null) document = WebDocument.Create(uri); Document = document; Thread thread = new Thread(IndexThisPage); thread.Start(); //document.Index(); return "OK"; } public static void IndexThisPage() { lock (Locker) { Document.Index(); } } </code></pre> <p><strong>Orginal Question</strong></p> <p>On all of my pages I have an ajax post that performs an index on the current page as well as all documents on the page. The indexer I'm using is Keyoti.</p> <p>What seems to happen is when one page is being indexed any request to any other page seems to not respond (i.e. its stuck on "Waiting for server") until the indexing is finished. Note: I'm loading the different pages from the same machine, because the code is local.</p> <p>Here's the ajax I'm using:</p> <pre><code>&lt;script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(window).load(function () { $.ajax({ type: "POST", url: "/DoIndex.aspx/Index", data: "{ uri: '" + self.location + "' }", contentType: "application/json; charset=utf-8", dataType: "json" }); }); &lt;/script&gt; </code></pre> <p>And the method it calls:</p> <pre><code>[WebMethod(true)] public static string Index(string uri) { WebDocument document = WebDocument.Get(uri); if (document == null) document = WebDocument.Create(uri); document.Index(); return "OK"; } </code></pre> <p>Anyone have any thoughts?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload