由于当前线程不在单线程单元中,因此无法实例化ActiveX控件'8856f961-340a-11d0-a96b-00c04fd705a2'.如何解决这个问题 [英] ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. how can solve this issue

查看:200
本文介绍了由于当前线程不在单线程单元中,因此无法实例化ActiveX控件'8856f961-340a-11d0-a96b-00c04fd705a2'.如何解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
当我使用sitemider时,我正在调用新的浏览器并遇到以下错误,请对此提供帮助.

ActiveX control ''8856f961-340a-11d0-a96b-00c04fd705a2'' cannot be instantiated because the current thread is not in a single-threaded apartment.

Hi all,
When I am working with sitemider, I am calling new browser and getting following error please help in this.

ActiveX control ''8856f961-340a-11d0-a96b-00c04fd705a2'' cannot be instantiated because the current thread is not in a single-threaded apartment.

推荐答案

如上所述
您可以通过自己创建一个线程并在该线程上指定STA单元状态来解决此问题.
As mentioned here[^]: The problem you''re running into is that most background thread / worker APIs will create the thread in a Multithreaded Apartment state. The error message indicates that the control requires the thread be a Single Threaded Apartment.

You can work around this by creating a thread yourself and specifying the STA apartment state on the thread.
var t = new Thread(MyThreadStartMethod);
t.SetApartmentState(ApartmentState.STA);
t.Start();



此处有更多讨论:
讨论1 [ ^ ]
讨论2 [此代码中的内部异常 [



More discussions here:
Discussion 1[^]
Discussion 2[^]
internal exception in this code[^]


这篇关于由于当前线程不在单线程单元中,因此无法实例化ActiveX控件'8856f961-340a-11d0-a96b-00c04fd705a2'.如何解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆