This appears to be a 'feature' of web deployment. The [STAThread] attribute
appears to be ignored when you launch apps off the web. I suspect this is
because your program isn't really the main executable - IEEXEC is the first
thing to be run. (Although the fact that IEEXEC appears to ignore this
attribute could reasonably be regarded as a bug.)
Try adding this:
static void Main()
{
Thread.CurrentThread.ApartmentState = ApartmentState.STA;
... carry on with rest of code as normal...
--
Ian Griffiths
DevelopMentor
----- Original Message -----
From: "Todd Hickerson" <[EMAIL PROTECTED]>
> I have a .NET Windows Forms application that has the Windows Media Player
> 9 Active X control embedded in the form. The application works fine when
> run in stand-alone mode (normal double-click .exe mode), but generates a
> threading error when I run it from a URL.
>
> See prior thread:
> http://discuss.develop.com/archives/wa.exe?A2=ind0303a&L=advanced-
> dotnet&T=0&F=&S=&P=6568
>
> The error message is: Could not instantiate ActiveX control ... bacause
> the current thread is not a single-threaded apartment.
>
> The Main() method as the [STAThread] attribute on it. I made a simple win
> forms app to test the problem, and it works just fine without the media
> player control, but as soon I the control is added and the reference
> to "AxWMPLib" is added, it fails, but only when deployed by URL.
===================================
This list is hosted by DevelopMentor� http://www.develop.com
You may be interested in Guerrilla .NET, 24 March 2003, in London
http://www.develop.com/courses/gdotnet
View archives and manage your subscription(s) at http://discuss.develop.com