开发者

Does ASP.NET default to STAThread or MTAThread?

Here is one of several sources that say ASP.NET defaults to single-threaded apartment, and that you have to set "executeInMta" to true in order to override this behavior (EDIT: As everyone has pointed out, I am wrong here - this refers to classic ASP. I thought there was more documentation backing this up for ASP.NET, but I was wrong):

http://www.iis.net/ConfigReference/system.webServer/asp/comPlus

Here is one of several sources that say that ASP.NET defaults to multi-threaded apartment, and that you have to set "aspCompat" to true in order to override this behavior:

http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp

So, which is开发者_开发百科 it? I currently do neither of the above overrides, and I want to be in MTA mode. Related question - is there a way to tell by debugging whether the currently-executing thread is STA or MTA?

Thank you.


The first article you linked refers to ASP, not ASP.NET. Classic ASP defaults to using STA, whereas ASP.NET defaults to using MTA.


Your first reference is from the ComPlus configuration setting for IIS7, and appears to apply to classic ASP.

ASP.NET threads are MTA by default.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜