1

can I use [STAThread] for Main in windows service , does this make any problem ?

Ata
  • 12,126
  • 19
  • 63
  • 97

1 Answers1

0

You can but it may not work as intended and can cause problems.

The best way to work around this seems to be by starting a new Thread and setting its ApartmentState to STA

Have a read of this post for more info:

.NET Windows Service needs to use STAThread

Community
  • 1
  • 1
Iain Ward
  • 9,850
  • 5
  • 34
  • 41