Главная страница | назад





Article #28400: Problems using ADO in a WebSnap application.

Question:

Why am I getting an internal server error (IIS) or an error that CoInitialize has not been called (Apache) in my WebSnap application?

Answer:

In any multi-threaded application you must manually call CoInitialize at the correct times if you use COM. Using ADO is using COM. In ISAPI, CGI or DSO applications each request is in a different thread, so you must call CoInitialize for each thread. Try calling it in the OnActivate, and call CoUninitialize in the OnDeactivate (requires you to use the ActiveX unit). Make sure your tables and connections are not open at design time.

It works in the web app debugger because CoInitialize has been called in the client web app (since, it is a com server).

Last Modified: 13-FEB-02