简体   繁体   中英

STA thread for windows Service

我可以在Windows服务的Main中使用[STAThread],这有什么问题吗?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM