问题描述
环境:VS 2003,Windows服务应用程序.
我有一个Windows服务应用程序,可以创建多个appdomains(用于ex 4).使用domain.ExecuteAssembly ["Myassembly.exe"]
方法.该应用程序使系统能够打开端口[TCP/IP或COM]并等待数据.因此,在myassembly.exe中,我需要为每个端口创建线程.我已经完成了,端口也处于侦听模式.
但是问题是,每当我从特定端口接收数据时,我都需要通过vbscript对其进行解析.为此,我使用了activex控件.[AxMSScriptControl.AxScriptControl]我无法在所有appdomain中为此控件创建实例.
我收到以下错误."Could not create instantiate for Activex Control ''XXX-XXX'' becuase the current thread is not in a single - threaded apartment" [STA].
谁能建议我如何在Appdomain中为activex对象创建实例.
谢谢,
Naveen
Hi,
Environment: VS 2003, Windows service application.
I have a windows service application which creates multiple appdomains[for ex 4]. using domain.ExecuteAssembly ["Myassembly.exe"]
method. This application enables the system to open the ports[TCP/IP or COM] and waitfor the data. So In myassembly.exe i need to create thread for each port. I have done it and the port is also in listen mode.
But the problem is whenever i receive the data from a particular port i need to parse it by vbscript. For that i am using an activex control.[AxMSScriptControl.AxScriptControl] I am not able to create instance for this control in all appdomains.
I am getting the following error."Could not create instantiate for Activex Control ''XXX-XXX'' becuase the current thread is not in a single - threaded apartment" [STA].
Can any one suggest me how to create an instance for activex object in Appdomain.
Thanks,
Naveen
推荐答案
这篇关于.net appdomain中的Activex对象实例-STA问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!