C
cwineman
I am trying to create a remote object that instantiates an ActiveX control.
Apparently ActiveX controls can only be created in STAThreads. When I make
the following call from the client:
_myRemoteObject = (IRemoteObject) Activator.GetObject(
typeof(MyLib.IRemoteObject), host );
I keep getting the following error:
{"Could not instantiate ActiveX control
'd5b7f60a-c223-4556-845d-fe5f59e49f03' because the current thread is not in
a single-threaded apartment." }
I did some searching on the error and people seem to recommend starting
threads as STAThreads. But both my server and client were started as
STAThread. Something is happening when I make the GetObject() call. When I
step into the constructor for my remote object it says that I am in a MTA
thread.
Does anyone know what I am doing wrong? Is there something that I can put
into my remoting configuration file to specify that the remote object should
be created in an STAThread?
-Corey
Apparently ActiveX controls can only be created in STAThreads. When I make
the following call from the client:
_myRemoteObject = (IRemoteObject) Activator.GetObject(
typeof(MyLib.IRemoteObject), host );
I keep getting the following error:
{"Could not instantiate ActiveX control
'd5b7f60a-c223-4556-845d-fe5f59e49f03' because the current thread is not in
a single-threaded apartment." }
I did some searching on the error and people seem to recommend starting
threads as STAThreads. But both my server and client were started as
STAThread. Something is happening when I make the GetObject() call. When I
step into the constructor for my remote object it says that I am in a MTA
thread.
Does anyone know what I am doing wrong? Is there something that I can put
into my remoting configuration file to specify that the remote object should
be created in an STAThread?
-Corey