|
-
Nov 15th, 2004, 12:23 PM
#1
Thread Starter
Frenzied Member
Force web service to use STAThread
Is it possible to have a web service that uses the single threaded apartment model? Dropping a COM component in the designed, then running, get an error that could not instantiate the ActiveX control because the current thread is not single-threaded apartment.
I know in a Windows Forms app, you can mark with the STAThread attribute, but there's no main method in a web service. Tried to mark the constructor with the attribute, was told I can't do that (methods only). Tried to mark the InitializeComponent method, but it didn't seem to have any effect (same error).
Any help is appreciated.
Thanks,
Mike
-
Nov 17th, 2004, 10:45 AM
#2
Thread Starter
Frenzied Member
Not a solution (yet), but I did find some information. Apparently it is impossible to force the main thread of a web service to use STA. A solution suggested was to spawn a new thread that was STA. Haven't gotten around to trying it yet.
-
Nov 22nd, 2004, 04:34 AM
#3
Retired VBF Adm1nistrator
Try using the AspCompat="true" page directive
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Nov 22nd, 2004, 10:14 AM
#4
Thread Starter
Frenzied Member
Page directive for a web service? Where would that go?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|