views:

1405

answers:

2

I am getting this error (see post title) from time to time as I interact with a web application I created. The application uses Ajax to communicate with a server, but doesn't do anything fancy specific to IE. I don't get this error, or any other error, when running the same application on Firefox or Safari.

Have you seen this error message before, know what can cause this, or have any recommendation on how to deal with this?

+2  A: 

This is a generic COM error. What is happening is that the AJAX component, XmlHttpRequest is a COM object, and therefore follow the rules for COM. What is likely happening here is that XmlHttpRequest is dispatching an incoming event. In the response to this event, there's probably code that calls out to a different COM object in another apartment which ultimately will cause deadlock. COM detects this and prevents this from happening.

The general recommendation is to break this type of application into using queues. Instead of responding to events immediately, save the event into a queue and return immediately. Then process the events asynchronously using a timer.

Tommy Hui
So you're saying that when the XmlHttpRequest object calls my call-back JavaScript function, I shouldn't run code right away but instead run it a little later with a window.setTimeout()?
Alessandro Vernet
Yes, that's what I'm suggesting.
Tommy Hui
Alright. I tried doing that (i.e. not run the JS right away when the Ajax response arrives but use setTimeout() to run it a bit later), but this unfortunately doesn't help.
Alessandro Vernet
A: 

I have the same error message. I am not running any extra software.

Can anyone explain how to solve this problem in lay terms?

Adam