cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Chris323
Level 2

Checking Service Endpoint

Hi Guys,

Just looking for some advice regarding an issue that I am trying to get around. The project I am working on is using InstallShield 2013 Premier to deploy the application. For the last few weeks I have been messing around with my own basic application and so far I am happy with the results.

Currently I have my package installing the client, a Windows Service and a run my database script. Now after the installtion has taken place I would like to see if I can connect to my Service endpoint, this would double check that the service is up and running with a connection.

If anyone has any suggestions on how I could do this then thats great. I have looked into creating a Powershell Script or developing a InstallShield script but they don't have this functionailty (from what I can tell anyway). The project is writtern in C#.

Thanks,
Chris
Labels (1)
0 Kudos
(2) Replies
DLee65
Level 13

Hi Chris,

Look up in InstallShield 'ServiceGetServiceState'. Below is an example.

//Stop Database
szServiceName = 'MSSQL$AMAZINGCHARTS';
ISDeterminePlatform();
nvResult = ServiceInitParams();
try
ServiceGetServiceState(szServiceName, nvServiceState);
if (nvServiceState != SERVICE_STOPPED) then
nvResult = ServiceStopService(szServiceName);
if (nvResult < ISERR_SUCCESS) then
GetExtendedErrInfo(svScriptFile, nvLineNumer, nvError);
SuiteLogInfo("ACSetupUtility WARNING: Failed to stop %s Service. Setup will continue but may fail.",szServiceName);
SuiteLogInfo("ACSetupUtility ERROR: ServiceStopService Error %d", nvError);
endif;
endif;
catch
SuiteLogInfo("ACSetupUtility WARNING: Failed to stop %s Service. Setup will continue but may fail.",szServiceName);
endcatch;


Note that this is written for use with a suite project, just comment out the logging there for SprintfMsiLog and log errors this way.

I am not sure if you need anything other than determining if the service is running or not. There is also the ServiceExistsService.
0 Kudos
Chris323
Level 2

DLee65 wrote:
Hi Chris,

Look up in InstallShield 'ServiceGetServiceState'. Below is an example.

//Stop Database
szServiceName = 'MSSQL$AMAZINGCHARTS';
ISDeterminePlatform();
nvResult = ServiceInitParams();
try
ServiceGetServiceState(szServiceName, nvServiceState);
if (nvServiceState != SERVICE_STOPPED) then
nvResult = ServiceStopService(szServiceName);
if (nvResult < ISERR_SUCCESS) then
GetExtendedErrInfo(svScriptFile, nvLineNumer, nvError);
SuiteLogInfo("ACSetupUtility WARNING: Failed to stop %s Service. Setup will continue but may fail.",szServiceName);
SuiteLogInfo("ACSetupUtility ERROR: ServiceStopService Error %d", nvError);
endif;
endif;
catch
SuiteLogInfo("ACSetupUtility WARNING: Failed to stop %s Service. Setup will continue but may fail.",szServiceName);
endcatch;


Note that this is written for use with a suite project, just comment out the logging there for SprintfMsiLog and log errors this way.

I am not sure if you need anything other than determining if the service is running or not. There is also the ServiceExistsService.


Thanks for your reply.

This has been useful and thanks for the example. If my service doesn't start up correctly I have placed logic to manage it however my requirement is more focused on the actual connection. I would like to create a channel to the Service Endpoint and make sure its there. This will proof that the service is just not up and running, but also ready to be used correctly.

I was looking on the same lines as a custom action. Perhabs creating a small C# Application that would create this 'channel' to the Service. I don't know how to call a C# Custom Action and I cannot work out away to return an error message back to the InstallShield wizard. But I don't know if I am on the right lines, there could be a easier way.

Thanks,
Chris
0 Kudos