Hi,
I am trying to get my head around remoting. I have managed to configure the
samples on MSDN and that is working fine. I have now tried to build my own
remoting application to test this and i can't get the application to
"Remote" basically what happens is that the client side uses the dll in the
same directory instead of the remote one. I can test this by stopping the
hosting application, and the client still works. I have a feeling that this
has something to do with the configuration file i am using. I will paste
some code below, and i would really appreciate if someone could let me know
where i am going wrong.
Many thanks
Niclas
'Class to be remotable
Public Class MyRemType
Inherits MarshalByRefObject
Public Function ReturnaAString() As String
Dim aString As String = "This is a string"
Return aString
End Function
End Class
''Client application Windows Form
Imports System.Runtime.Remoting
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myRemobj As New MyRemType
RemotingConfiguration.Configure("Client.exe.config ")
MsgBox(myRemobj.ReturnaAString)
End Sub
End Class
''Configration file app.config in the windows form application
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="MyRemType,MyRemType"
url="http://localhost:8989/MyRemType.rem"
/>
</client>
</application>
</system.runtime.remoting>
</configuration>
''Server console app
Imports System
Imports System.Runtime.Remoting
Public Class Server
Public Shared Sub Main()
RemotingConfiguration.Configure("Listener.exe.conf ig")
Console.WriteLine("Listening for requests. Press Enter to exit...")
Console.ReadLine()
End Sub
End Class
'Server app config file
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown
mode="Singleton"
type="MyRemType, MyRemType"
objectUri="MyRemType.rem"
/>
</service>
<channels>
<channel ref="http" port="8989"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>