Solved

Remoting "Requested Service not found"

Posted on 2010-08-26
6
1,089 Views
Last Modified: 2012-05-10
Hi,

I am trying to develope an remoting application but I am having a problem. Everytime I run a function from I got the "Requested Service not found" error. How can I solve it?
'Server side:

 Private Sub InitializeServer()



        Dim tcpPort As Integer = 8090



        Dim serverProv As New BinaryServerFormatterSinkProvider()

        serverProv.TypeFilterLevel = TypeFilterLevel.Full

        RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off



        serverProv.TypeFilterLevel = TypeFilterLevel.Full

        Dim propBag As IDictionary = New Hashtable()



        Dim isSecure As Boolean = False

        propBag("port") = tcpPort

        propBag("typeFilterLevel") = TypeFilterLevel.Full

        propBag("name") = "chn_comm"

        Dim tcpChan As TcpChannel = New TcpChannel(propBag, Nothing, serverProv)

        ChannelServices.RegisterChannel(tcpChan, isSecure)



        Dim uRI As String = "comm"

        ' ---------------------------------------------

        RemotingConfiguration.RegisterWellKnownServiceType(GetType(DataExchange.DataExchange), uRI, WellKnownObjectMode.SingleCall)



    End Sub



'Shared Library

Public Class DataExchange

    Inherits MarshalByRefObject



    Public test As String = "Merhaba Dünya"



    Public Sub SetValue(ByVal val As String)

        test = val

    End Sub



    Public Function GetValue() As String

        Return test

    End Function





End Class



'Client Code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim de = CType(Activator.GetObject(GetType(DataExchange.DataExchange), "tcp://127.0.01:8090/comm/"), DataExchange.DataExchange)

        de.SetValue("test")

        MsgBox(de.GetValue)

    End Sub

Open in new window

0
Comment
Question by:emresamisuzer
  • 3
  • 3
6 Comments
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
dont know if this helps but look at the solution here http://bytes.com/topic/c-sharp/answers/245188-remoting-object-requested-service-not-found

>> I fixed it by overriding the default MarshalByRefObject.InitializeLifetimeService to return null, which tells Remoting that the lease should never expire.
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
Read up more about this and you need to be a little careful as apparently it can give out memory leaks if not cleaned up properly (i.e. proper disconnects etc)

So reading this here is a possible solution regarding using InitialiseLifetimeServer http://www.cookcomputing.com/blog/archives/000258.html

Another thing to check is values you are using eg port number. Are they definitely correct?
0
 

Author Comment

by:emresamisuzer
Comment Utility
I've already seen the MarshalByRefObject.InitializeLifetimeService solution but I didn't undestand how to do it. Could you please explain?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:emresamisuzer
Comment Utility
I tried with the second example you have sent but the result is same.
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
Hiya, did u get anywhere with this? I couldnt find anything else to try. might be worth clicking on request attention to get a bump.
0
 

Accepted Solution

by:
emresamisuzer earned 0 total points
Comment Utility
Yes, I found a solution. The problem was not the timeout, I think there was another problem with the code. I found another sample from a web site and it worked.
'Init Server

 	Dim ServiceChannel As IChannel

        Dim serverProv As BinaryServerFormatterSinkProvider = New BinaryServerFormatterSinkProvider

        Dim clientProv As BinaryClientFormatterSinkProvider = New BinaryClientFormatterSinkProvider

        Dim Props As IDictionary = New Hashtable

        Dim IpInjProvider As New IpInjectorSinkProvider



        serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full

        Props("port") = "8000"

        Props("name") = "MyApplication"

        serverProv.Next = IpInjProvider



        ServiceChannel = New TcpChannel(Props, clientProv, serverProv)

        '---------------------------------------------



        ChannelServices.RegisterChannel(ServiceChannel)



        RemotingConfiguration.RegisterWellKnownServiceType( _

              GetType(ActwinBillingCommunicationDataExchange.Queue), _

              "MyApplication", WellKnownObjectMode.Singleton)





'Connect to server

Private server As IRemoteLib

    Private Channel As System.Runtime.Remoting.Channels.Tcp.TcpChannel 'New System.Runtime.Remoting.Channels.tcp.TcpChannel(0)

    Private serverProv As BinaryServerFormatterSinkProvider

    Private clientProv As BinaryClientFormatterSinkProvider

    Private props As IDictionary = New Hashtable



serverProv = New BinaryServerFormatterSinkProvider

        clientProv = New BinaryClientFormatterSinkProvider

        serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full

        props("port") = 0

        props("connectiontimeout") = 120000

        'props("name") = privServiceName

        Channel = New TcpChannel(props, clientProv, serverProv)

ChannelServices.RegisterChannel(Channel)



            server = CType(Activator.GetObject(GetType(IRemoteLib), txt_remoting_server.Text.Trim), IRemoteLib)

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now