Coinitialize error on IntraWeb using ADO

萝らか妹 提交于 2019-12-10 10:08:28

问题


Already asked on the Evil Exchange, but as always that was no help. I'm having this problem today:

When creating a stand alone web application using IntraWeb, I get this exception in the IDE when I try to test out a session from my app in the browser:

First chance exception at $7C812A6B. Exception class EOleSysError with message 'CoInitialize has not been called'. Process WebContactManager.exe (1112)

If I click "continue" on the IDE exception dialog, the browser itself just shows:

200 OK

...rather than the controls on my main form.

This error does not seem to occur when I replace ADO with other database components such as dbExpress or BDE.

What is this error telling me, and how do I fix it?

(Note I'm using the stock "VCL for the Web" IntraWeb components which come built-in with D2007).

Thanks in advance for any and all help!


回答1:


The "solution" provided in the link you quoted is basically wrong or at least incomplete. Only by setting ServerController.ComInitialization to ciMultiThreaded to true IW will gurantee that every thread will get COM initialized correctly. (for example think about Ajax callbacks)

If you create your own custom threads then you will have to call CoInitialize for that thread on your own though - as Intraweb does not know about your custom threads.




回答2:


Just found an answer to this here:

I found a more elegant solution as the whole problem originated from using Intraweb, I rather get Intraweb to initialise com for me. This sorts it out nicely.

When using your MS SQL DbExpress driver or ADO driver with Intraweb, you must set the ComInitialization property in the ServerController to ‘ciMultiThreaded’.

This will eliminates the "CoInitialize has not been called" error.



来源:https://stackoverflow.com/questions/1134845/coinitialize-error-on-intraweb-using-ado

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!