[ADO]如何修改ADO的线程模型
来源:互联网 发布:柒牌网络系列怎么样 编辑:程序博客网 时间:2024/05/18 12:00
ADO缺省情况下当然是Apartment线程模型。
If you are using this in IIS and ADO is only being used at page scope
then it should be fine.
If you are using it at the session or application level then you will
need to mark it as both.
那么怎么改为Both呢?
可能就是改一下注册表里面的线程模型。
在
C:/Program Files/Common Files/System/ado
文件夹下,有两个reg文件,很有趣,可能就是这个意思。
ADOFRE15.REG
ADOAPT15.REG
其中,ADOFRE15.REG就是这个内容:
REGEDIT4
[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000507-0000-0010-8000-00AA006D2EA4}/InprocServer32]
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000514-0000-0010-8000-00AA006D2EA4}/InprocServer32]
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{0000050B-0000-0010-8000-00AA006D2EA4}/InprocServer32]
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000535-0000-0010-8000-00AA006D2EA4}/InprocServer32]
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000541-0000-0010-8000-00AA006D2EA4}/InprocServer32]
"ThreadingModel"="Both"
okay, you'll see that the ThreadingModel is adjusted for the following
coclasses:
1. Command
2. Connection
3. Parameter
4. Recordset
5. Error
If the threading model selected is "Apartment" (the default), then the
objects listed above can be accessed only by the thread created it. If
threading model is "Both" and the object is created in an STA, then all
access to it will through the single thread that runs in the STA. If
threading model is "Both" and the object is created in an MTA, then any
thread in this MTA will have direct access to it.
If the objects integrate FTM (I don't know whether ADO does this or not),
then different threads in different apartments will have direct access to
the objects (without proxies).
You can configure ADO.NET to use the free-threaded model by importing the following registry data. To modify the registry, copy this data to a REG file (such as Adofre.reg) and import it using the Regedit.exe program (for example, Regedit /s Adofre.reg).
The following registry information is included on Windows 2000 and Windows Server 2003 systems in the Adofre15.reg file. The batch file Makfre15.bat updates the registry with the information in Adofre15.reg. Both files are located in Program Files/Common Files/System/ado/.
REGEDIT4[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000507-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Both"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000514-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Both"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{0000050B-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Both"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000535-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Both"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000541-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Both"
If you do not plan to use ADO.NET from ASP.NET applications, you can use the apartment threading model for better ADO.NET performance with legacy applications such as those created with Visual Basic version 6. You can configure apartment threading by importing the following registry data. To modify the registry, copy this data to a REG file (such as Adoapt.reg) and import it using the Regedit.exe program.
The following registry information is included on Windows 2000 and Windows Server 2003 systems in the Adoapt15.reg file. The Makapt15.bat batch file updates the registry with the information in Adoapt15.reg. Both files are located in /Program Files/Common Files/System/ado/.
REGEDIT4[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000507-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Apartment"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000514-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Apartment"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{0000050B-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Apartment"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000535-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Apartment"[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/{00000541-0000-0010-8000-00AA006D2EA4}/InprocServer32]"ThreadingModel"="Apartment"
http://www.faqchest.com/msdn/DCOM/dcom-00/dcom-0011/dcom00112713_21236.html
From: Hitesh Mittal <[PRIVACY PROTECTION]>
Subject: Re: Changing threading model of ADO.
go to c:/programfiles/common files/system/ado
you should see adoapt15.reg and adofre15.reg. Run one of these to register
Apartment or Both.
There is nothing wrong in changing the apartment model to Both, the objects
will be created in the same apartment as the thread is initialized with.
Hitesh Mittal
感谢Alex Matevossian和Jim Cirone。
Zhengyun (at) tomosoft.com 收藏。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=12728
- [ADO]如何修改ADO的线程模型
- [ADO]如何修改ADO的线程模型
- [ADO]如何修改ADO的线程模型
- [ADO]如何修改ADO的线程模型
- [ADO]如何修改ADO的线程模型
- 基本的ADO模型
- ADO:修改
- 基本的 ADO 编程模型
- ADO.Net的对象模型
- ADO对象模型的概要
- ADO对象模型的概要
- 使用对象的ADO模型
- 基本的 ADO 编程模型
- ADO如何新增修改删除数据库的记录呢
- ADO如何建立修改删除表
- VB+ADO+Access如何修改数据
- 使用对象的 ADO 编程模型
- ado访问数据库的最简模型
- Microsoft Interview Questions
- MyEclipse6.0.0 GA里配置struts1.2+hibernate3.0+spring1.2异常
- COM+对象池组件崩溃调试手记
- 分页查询
- [SQL]不要让SQLServer帮你自动转换SQL命令中的数据类型
- [ADO]如何修改ADO的线程模型
- [SIP]SIP系列标准导航公告板
- 部分省短信乱码或空短信问题的汇报
- 再论"业余"和"专业"--致力职业化 提高成功力
- [Boost]如何将UNIX风格时间转换为标准格式
- 【职经分享】走出公司-进入产业-建立圈子
- Microsoft的身份和访问管理解决方案
- [SQL]启动SQLServer的死锁检查
- QC之旅途笔记