CastleSoft Posted September 12, 2014 Posted September 12, 2014 How do you deploy a FireDac based UniGUI isapi DLL on IIS so that it finds the FDConnections.ini file ? Given the doc's say: http://docwiki.embarcadero.com/RADStudio/XE6/en/Defining_Connection_(FireDAC) If ConnectionDefFileName is not specified: Look for FDConnectionDefs.ini in an application EXE folder. If the file above is not found, look for a file specified in the registry key HKCU\Software\Embarcadero\FireDAC\ConnectionDefFile. By default it is C:\Users\Public\Documents\Embarcadero\Studio\14.0\FireDAC\FDConnectionDefs.ini Because its an isapi.dll and not an EXE what location will UniGui look for the FDCOnnectionDefs.ini file ? Also with the 'MyApp.dll' running on isapi as non-current user, it won't look in HKCU ?? I could add some extra initial load code to read settings, but it would be nice if I could place it in a folder and be loaded automatically ? Any ideas ? Thanks Andrew
Administrators Farshad Mohajeri Posted September 12, 2014 Administrators Posted September 12, 2014 EXE folder and DLL folder are both the same. It must be able to find ini file if you copy it to folder your DLL resides.
rencarnacion Posted September 12, 2014 Posted September 12, 2014 That's what I do. I'm Using FireDac too procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject); begin dbConecta.Close; dbConecta.Params.LoadFromFile(UniServerModule.StartPath + '\Files\dbConecta.ini'); dbConecta.Open(); end;
CastleSoft Posted September 15, 2014 Author Posted September 15, 2014 After some playing I think the following is a cleaner solution: 1) Drop an FDManager onto the ServerModule (NOT the MainModule as you can only have 1 INSTANCE). 2) Click on the FDManager Events tab in the Object Inspector, this should show and event called: 'BeforeLoadConnectionDefFile' 3) Double click this and enter the the following: procedure TUniServerModule.FDManager1BeforeLoadConnectionDefFile(Sender: TObject); var connDef: string; begin if FDManager1.ConnectionDefFileName.IsEmpty then connDef := 'FDConnectionDefs.ini' else connDef := FDManager1.ConnectionDefFileName; FDManager1.ConnectionDefFileName := UniServerModule.StartPath + connDef; end; That's it. You don't have to close connections/activate queries/tables/etc etc. If you don't enter a name in the ConnectionDefFileName for the FDManager it will default to the standard FDCOnnectionDefs.ini filename. 2
Recommended Posts