4

Related to questions like this and this about ASP.NET thread agility: Can a windows service written in C# exhibit the same thread agility behavior seen in ASP.NET? Or is thread agility more a feature of IIS than .NET?

Really what I'm after is can I be sure that thread management within a windows service is entirely up to the service itself? Or can .NET hop threads within a long-running service if it chooses to do so?

Community
  • 1
  • 1
sbrown
  • 171
  • 6

3 Answers3

5

No. A windows service is not managed by the IIS pipeline and any threads that are created must be created by the service code itself.

John Wu
  • 50,556
  • 8
  • 44
  • 80
  • OK, so thread agility is more a feature of IIS than the .NET framework. That's what I wanted to know! – sbrown May 22 '15 at 19:37
3

Thread agility is IIS specific. Windows service will not have that behaviour.

Riad Baghbanli
  • 3,105
  • 1
  • 12
  • 20
2

Thread agility is a property of how the thread pool mechanism interacts with asynchronous I/O. You can implement a similar mechanism yourself, but it isn't an automatic behavior.

Gabe
  • 84,912
  • 12
  • 139
  • 238