Could not instantiate ActiveX control because the current thread is not in a si

K

Karthey

Getting "Could not instantiate ActiveX control because
the current thread is not in a single-threaded
apartment. " error while using AxMSComLib control.

I am working on a Web Application. My soultion has 3
projects in it. One of the project is using AXMSComLib.
Since this is web application I count find any Main()
method to add [STAThread].
I did add before the instance of the object AxMSComLib:
"Thread.CurrentThread.ApartmentState = ApartmentState.STA;"
Its not working. Any help will be really appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top