HighTechTalks DotNet Forums  

Requested Service Not Found

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Requested Service Not Found in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
dlarkin77
 
Posts: n/a

Default Requested Service Not Found - 01-04-2006 , 07:28 AM







Hi,

I'm pretty new to the whole .NET concept. I'm trying to make a simpl
VB.NET application that will tell me the current time. But whenever
try to call any remote methods I get an error telling me that th
"Requested Service Was not Found". Can anyone let me know what thi
means and how I can fix it?

I've included some of the code that I'm using:

Code
-------------------

Public Interface MailInterface

Function GetTime() As String

End Interface

-------------------



Code
-------------------

Public Class MailImpl
Inherits MarshalByRefObject
Implements MailInterface.MailInterface

Public Function GetTime() As String Implements MailInterface.MailInterface.GetTime

Return "The time is: " & DateTime.Now.ToString

End Function
End Class

-------------------



Code
-------------------

'This is in the Server application, , creating channels etc.

Dim oServerProv As BinaryServerFormatterSinkProvider = New BinaryServerFormatterSinkProvider
Dim oClientProv As BinaryClientFormatterSinkProvider = New BinaryClientFormatterSinkProvider
Dim oProps As IDictionary = New Hashtable

oServerProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilter Level.Full
oProps("port") = "1234"
oProps("name") = "Mail"

oChannel = New TcpChannel(oProps, oClientProv, oServerProv)

ChannelServices.RegisterChannel(oChannel, False)

RemotingConfiguration.RegisterWellKnownServiceType (GetType(MailImpl.MailImpl), "Mail", WellKnownObjectMode.Singleton)

Try
oServer = CType(Activator.GetObject(GetType(MailImpl.MailImp l), "tcp://localhost:1234/Mail"), MailInterface.MailInterface)
If oServer Is Nothing Then MsgBox("Server Not Found")
Catch ex As Exception
Debug.WriteLine(ex.Message)
MsgBox(ex.Message)
End Try

-------------------



Code
-------------------

' This is in the client application, creating channels etc.

oServerProv = New BinaryServerFormatterSinkProvider
oClientProv = New BinaryClientFormatterSinkProvider
oServerProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilter Level.Full
oProps("port") = iPortNum
oProps("name") = "Mail"
oChannel = New TcpChannel(oProps, oClientProv, oServerProv)
ChannelServices.RegisterChannel(oChannel, False)

Try
oServer = CType(Activator.GetObject(GetType(MailInterface.Ma ilInterface), "tcp://localhost:" & iPortNum & "/Mail"), MailInterface.MailInterface)
If oServer Is Nothing Then
MsgBox("Server Not Found")
Return False
Else
Return True
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try

-------------------



Code
-------------------

' Actually calling the remote method from the client

Console.WriteLine(oServer.GetTime)

-------------------


Any help will be much appreciated. Thanks very much,

dlarkin7

--
dlarkin7



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.