Will a request in IIS run on a single thread?

前端 未结 4 978
情书的邮戳
情书的邮戳 2020-12-10 15:38

We have a system that runs in IIS.

The system should always run using the same \"culture\", but we cannot rely on the server settings being set correct.

One

4条回答
  •  不知归路
    2020-12-10 16:37

    No. ASP.NET exhibits thread agility - in some situations, the request may move from one thread to another at specific points in its request lifecycle. (It's not "just anywhere"; this blog post gives more specific details.)

    Unfortunately this isn't as clearly documented as it might be, and it's relatively hard to provoke - so you can easily get into the situation where under test loads, all is fine - but in production things go wrong.

    However, some tests I ran a while ago (look for "jskeet" within the page) suggests that Thread.CurrentCulture is preserved even when thread agility kicks in.

提交回复
热议问题