Cannot access a Server in a Windows Service

Hi,

I try to port an RO SDK client app to a Windows Service.
The application itself can access the web server (that is outside the company).
But once converted a windows Service When I try to consume the web service I get a EROException :: Unable to connect to remote server.

in the Service the RO comp are created at runtime since it works in threads but the targetURL is well passed to the Synapse Chanel like in the “Standard” Application.

Is there a way to check befor connection where he tries to connect ?
Could this be a Windows restriction and Is there a specific setting (in RO or in Windows) to not block this ?

Not that I have added uROCOMinit unit in the project uses because of XML problem.
the problem could comme from here ?
Note that in my service I have multiple threads and each thread has their own RO components that communicate with the server.

Regards

pls read The difference between the ‘Local System’ account and the ‘Network Service’ account? article.
account of your service can have the limited rights.

it sometimes may cause problems with some GUI dialogs , but for service, it should be ok.

Thanks Evgeny for your reply,

I have try to change the account of the service to Network service and no succes.

So I decided to make a small app where like in my service I crete the RO components at runtime like this

//The properties are taken from a dfm in a datamodule in a app that works and where the comp are created in DesignTime.
    ROMessage := TROSOAPMessage.Create;
    ROMessage.OnReadFromStream := BusinessEventMessageReadFromStream;
    ROMessage.SerializationOptions := [xsoStrictStructureFieldOrder, xsoDocument, xsoSplitServiceWsdls];



    SynapseChannel := TROSynapseHTTPChannel.Create(Nil);
    SynapseChannel.UserAgent := 'Mozilla/4.0 (compatible; Synapse)';
    SynapseChannel.KeepAlive := True;
    SynapseChannel.DispatchOptions := [];
    SynapseChannel.OnSendStream := BusinessEventSynapseChannelSendStream;
    SynapseChannel.TargetUrl := 'http://127.0.0.1:8099/bin';

    RORemoteService := TRORemoteService.Create(Nil);
    RORemoteService.ServiceName := 'BusinessEventManagerService';
    RORemoteService.Channel := SynapseChannel;
    RORemoteService.Message := ROMessage;

   //This part is taken from the code of the app that works
    fService := (RORemoteService As IBusinessEventManagerService);
    TROBaseHTTPChannel(RORemoteService.Channel).targetURL := 'MyWSLink';

    SynapseChannel.http.UserName := 'myLogin';
    SynapseChannel.http.Password := 'MyPassword';

But unfortunatelly same error message : EROException : Unable to connect to remote server.
What am I doing wrong ?

Regards

Armindo

try to launch your service under existed user instead of predefined users like Network service, etc.
will it work?

As I said previously, even in a small app (not a service this time) I face the problem, so this is not related to service but runtime creation of the RO components.

can you create a small testcase for this case, pls?
you can use the MegaDemo server as the server for this testcase.

Evgeny,
I have try to produce some testcase and discovered something.

It has nothing to do with Design Time or runtime because, using creation in runtime in the client project generated by RO Wizard works fine.
Trying to connect in design time or runtime fails on a project created from scratch by myself…
Is there some specific settings done in a project generated by the Wizard ? I see for instance many RO dcu units in the project folder.
What units (or anything else) the Client really needs ? I have just added the int file.

Regards

these RO DCU shouldn’t have any influence.
you have RO sources in library path so delphi compiler recompiles them and put into project folder.
you are using SOAP so you are needed uROCOMInit as 1st unit in your project