HI,
For some reasons, i need to pop up a form containing webbrowser control using windows service. But when it is initializing the web browser control in the form, it is throwing an error in the stacktrace
System.Threadin g.ThreadStateEx ception: Could not instantiate ActiveX
control '8856f961-340a-11d0-a96b-00c04fd705a2' because the current
thread is not in a single-threaded apartment.
at System.Windows. Forms.AxHost..c tor(String clsid, Int32 flags)
at System.Windows. Forms.AxHost..c tor(String clsid)
at AxSHDocVw.myWeb Browser..ctor()
at MyNamespace.MyC lass.Initialize Component()
at MyNamespace.MyC lass..ctor()
at MyServiceNamesp ace.MyService.O nStart(String[] args)
The attribute [STAThread] already exists before the Application's Main().
Please suggest a solution
Thanks & Regards
For some reasons, i need to pop up a form containing webbrowser control using windows service. But when it is initializing the web browser control in the form, it is throwing an error in the stacktrace
System.Threadin g.ThreadStateEx ception: Could not instantiate ActiveX
control '8856f961-340a-11d0-a96b-00c04fd705a2' because the current
thread is not in a single-threaded apartment.
at System.Windows. Forms.AxHost..c tor(String clsid, Int32 flags)
at System.Windows. Forms.AxHost..c tor(String clsid)
at AxSHDocVw.myWeb Browser..ctor()
at MyNamespace.MyC lass.Initialize Component()
at MyNamespace.MyC lass..ctor()
at MyServiceNamesp ace.MyService.O nStart(String[] args)
The attribute [STAThread] already exists before the Application's Main().
Please suggest a solution
Thanks & Regards