Alexandre Machado
Re: Cannot change thread mode after it is set
Shortcut to this article

Re: Cannot change thread mode after it is set

> {quote:title=Alexandre Machado wrote:}{quote}
> > {quote:title=Zane Leo wrote:}{quote}
> > Delphi XE - IW Ultimate
> > 
> > ISAPI App working perfectly compiled with IW 12.2.12;
> > 
> > Rebuilt ISAPI app with IW
> > 
> > On my dev Win 7 / IIS 7.5 the ISAPI app works fine
> > 
> > On a deploy Win 2008 Server / IIS 7.0 when a user attempts to connect to the ISAPI app generated the following error:
> > "Error message raised by the application: Cannot change thread mode after it is set"
> > 
> > I created a stand alone version of the app and it works fine on the same Win 2008 Server.
> > 
> > Been "bugging" me for days. Any suggestions?
> > 
> > For ISAPI ComInitialization  is set to ciMultiThreaded and nowhere in the code is it changed...
> > 
> > TIA
> > 
> > Zane
> Hi Zane,
> I've created a new ISAPI IW application, set ComInitialization to ciMultiThreaded and deployed it in Win 2008 R2.
> Everything works as expected and the application is working perfectly.
> Did you try to set ComInitialization to something else and see what you get?
> Do you use some 3rd party libraries also using COM? Subsequent calls to CoInitialize or CoInitializeEx may trigger that error... 
> Also, are you sure that your IIS setup is correct? A nice how-to can be found here:
> Best regards


I have tried other settings but they did not work - other errors were generated.
I have ADO components in the UserSession for MS SQL for connection to 5 different DBs but the same code base comoiled with 12.2.12 works perfectly.

I will look at the uses sections again.

I think I know the Chee-Yang blog by heart....
FYI: Phrase searches are enclosed in either single or double quotes
24-Jul 11:00 utc Operating system upgrade in process, expect some down time.
Originally created by
Tue, 23 Jul 2019 14:54:08 UTC
Copyright © 2009-2019
HREF Tools Corp.