Remoting With Windows Service

J

John Fred

Salve,
I have write a service Windows for the remoting.

I have a dll Server (OLD COM+)

For Configure DLL Server I user Config File
Es.
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="50000"/>
</channels>
<service>
<wellknown type="DllServer.Classe1, DllServer" mode="Singleton"
objectUri="Classe1.rem" />
<wellknown type="DllServer.Classe2, DllServer" mode="Singleton"
objectUri="Classe2.rem" />
</service>
</application>
</system.runtime.remoting>
</configuration>

This is my code in the service:

Protected Overrides Sub OnStart(ByVal args() As String)
RemotingConfiguration.Configure("MyService.exe.config")
Console.ReadLine()
End Sub

If i start service windows this problem to me:

the service is started, but it stops. Some services stops itself if there
aren't operations to execute, this is, for example, the case of the "event
viewer" service application

WHY?
 
J

Jay B. Harlow [MVP - Outlook]

John
Console.ReadLine()
What do you expect this line to do?

A Service does not have a UI, I would suspect that line is throwing an
exception or worse it is not allowing the service's OnStart method to
complete in a timely method! Causing your service not to start. Do you see a
message in the Application Event Log that your service started or failed to
start? I would expect a failed to start message.

Matthew MacDonald's book "Microsoft Visual Basic .NET Progammer's Cookbook"
has a handful of topics on using Remoting within a Windows Service, other
then the Console.Readline, your code looks like it should work... Assuming
your config is correct...

You OnStart should just need:
Protected Overrides Sub OnStart(ByVal args() As String)
RemotingConfiguration.Configure("MyService.exe.config")
End Sub

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top