3
votes

I'm trying to use Internet Explorer 9's JavaScript engine from my .NET library using COM interop. Whilst working fine in test code, it's failing when run within ASP.NET (on IIS).

My library is using IE's JavaScript engine to load the CoffeeScript compiler. So ideally I'd like to load the compiler once, then reuse the single IE script engine instance. I have a lock around calls to the script engine, but I think I'm still getting threading issues related to COM.

Is it possible for a COM object to be called from different .NET threads? (i.e. threads for different IIS web requests).

I'm a total COM newbie, so any advice, links, etc would be great.

2
I wonder, if you just need for the CoffeeScript compiler, could you host it in another process? - Andy S

2 Answers

0
votes

As I remember IIS doesn't allow you to operate with threads i.e. create or manage them. It's not safe in web applications. What you can to do is to store your compiler in server's variable: application or session

0
votes

Many COM object that you might want to use from an ASP.NET application were designed for a desktop environment, not a server environment. They may not expect to be called from different threads, for instance, or may depend on a UI message pump for synchronization.