Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Windows Services and .NET Remoting

Status
Not open for further replies.

bsimbeck

Programmer
May 2, 2003
44
US
I have created and successfully installed (and have running) as windows service with .Net Remoting. However when I try to connect using the client application it tells me that my connection was refused. I can't figure out why, I have tried a user accout, network service, local service, and local system. This is the only code in my onStart event.

Code:
 Try
            Dim MyChannel As TcpChannel
            Dim Port As Integer = "4895"
            MyChannel = New TcpChannel(Port)
            ChannelServices.RegisterChannel(MyChannel)

            '--reg all of the classes
            Dim MedCommObj As System.Type
            MedCommObj = GetType(MedCommServer.MedComm)
            RemotingConfiguration.RegisterWellKnownServiceType(MedCommObj, "MedCommClass", WellKnownObjectMode.SingleCall)
        Catch ex As Exception
            WriteError(ex)
        End Try

any assistance would be helpful!
 
How do you know that the service started successfully? Look in the event log - you can set a service to automatically dump exception details in there. Throw an exception in the onStart to make sure this is working.

If the service has started, you should see something listening on the port number you have chosen - type netstat -a at the command prompt.

The port number you have chosen, 4895, is too low. I can't remember the ports you are encouraged to use, but something around 60000 is better, since no other program is likely to be using it.

When doing windows services, I like to have a win form version with start and stop buttons, but the same code, so that I can test things more easily.

If none of this helps, there may be something wrong with your client code, which you have not posted.

Hope this helps


Mark [openup]
 
Thanks mark I will try this and see what happens. I know that the client worked because I was using it with the windows form application that the remoting host was running on before (I forgot to mention that this was a regular windows app that I have found the need to convert to a windows service). I do that it is running becasue the event logs tell me that it succesfully started and my customer error event log I use to log my try-catch errors are empty. I will check with netstat I think that for some reason the security level might not be letting access the network card but I am not sure.

Thanks,

Branden
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top