Search code examples
delphiiisdelphi-7intraweb

Delphi Intraweb website crash on IIS


I've made an Intraweb ISAPI application. After building the dll, I've created an Web site on IIS and a pool for the application. On the Inetpub directory the permissions are set for the Internet Guest Account and for the IIS_WPG accounts.

When I'm trying to access the webpage from IE (http://ip.0.0.1/website/application.dll) it returns me HTTP 500 or

enter image description here

errors. After searching on the Internet it says that is a problem of COM initialization. But in the datamodule of the application there is this code:

initialization
  CoInitialize(nil);

finalization
  CoUninitialize;

Can anybody give any advice?


Solution

  • Do not use your own CoInitliaze calls, but instread use the ServerController and set the ComInitialization property to ciMultiThread for example.

    From my IntraWeb Courseware manual: "The ComInitialization property of type TComInitialization (ciNone, ciNormal, ciMultiThread) is needed when the application requires the use of (D)COM. Since IntraWeb executes requests in different threads, each thread must make its own call to CoInitialize. By default this property is set to ciNone, to indicate that no COM support is required. If you need COM support - for example if you want to connect to a DataSnap server - then you need to set ComInitialization to ciNormal or ciMultiThreaded. Personally, I’ve found no reason not to set it to ciMultiThreaded when working with COM in one way or another inside an ISAPI DLL, although IIS 6 and higher may handle the required ComInitialization already for you, and you should set it to ciNone (but it looks like it’s ignored when set to some other value, so ciMultiThread won’t hurt either)."