What does AspCompat="true" mean and when should I use it?

简介:
AspCompat is an aid in migrating ASP pages to ASPX pages. 
It defaults to false but should be set to true in any ASPX 
file that creates apartment-threaded COM objects--that is, 
COM objects registered ThreadingModel=Apartment.

That includes all COM objects written with  Visual Basic 
6.0. AspCompat should also be set to true (regardless of 
threading  model)  if the page creates COM objects that 
access intrinsic ASP objects such as Request and Response. 
The following directive sets AspCompat to true:

<%@ Page AspCompat="true" %>  
Setting AspCompat to true does two things. First, it makes 
intrinsic ASP objects available      to the COM components 
by placing unmanaged wrappers around the equivalent ASP.NET 
objects. 

Second, it improves the performance of calls that the page 
places to apartment- threaded COM objects by ensuring that 
the page (actually, the thread that processes the  request 
for the page) and the COM objects it creates share an 
apartment. 

AspCompat="true" forces ASP.NET request threads into single-
threaded apartments (STAs). If those threads create COM 
objects marked ThreadingModel=Apartment, then the objects 
are created in the same STAs as the threads that created 
them. Without AspCompat="true," request threads run in a 
multithreaded apartment (MTA) and each call to an STA-based 
COM object incurs a performance hit when it's  marshaled 
across apartment boundaries.

Do not set AspCompat to true if your page uses no COM 
objects or if it uses COM objects that don't access ASP 
intrinsic objects and that are registered 
ThreadingModel=Free or  ThreadingModel=Both.
目录
相关文章
|
6月前
Should pass resolved color instead of resource id here: getResources().getColor(R.color.brown)
Should pass resolved color instead of resource id here: getResources().getColor(R.color.brown)
53 6
|
6月前
|
自然语言处理 数据库
Expected one result (or null) to be returned by selectOne(), but found: 2
Expected one result (or null) to be returned by selectOne(), but found: 2
93 0
|
Java
Can&#39;t convert boolean to string automatically, because the &quot;boolean_format&quot; setting was &quot;true,false&quot;
五月 11, 2017 5:06:50 下午 freemarker.log._JULLoggerFactory$JULLogger error 严重: Error executing FreeMarker template FreeMarker template error: Can't con...
2778 0
|
数据库
Field ‘id‘ doesn‘t have a default value
Field ‘id‘ doesn‘t have a default value
170 0
|
XML 数据格式
XML问题: The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed
XML问题: The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed
197 0
|
JSON fastjson 数据格式
报错:JSONException: illegal identifier : {pos 1, line 1, column 2{{&quot;group&quot;:&quot;trade_p0&qu
报错:JSONException: illegal identifier : {pos 1, line 1, column 2{{&quot;group&quot;:&quot;trade_p0&qu
565 0
|
数据库
Incorrect result size: expected 1, actual 2
Incorrect result size: expected 1, actual 2
898 0