Dear Friends,
Hope all you are fine.
I am working on a .net remoting project
When i use console application as a host, everything works fine. This example has taken from Apress book. Code are as follows:
'Remoting object: Project name- SimpleLibrary (class library project), Class file name- Calculator.vb
'Calculator.vb code:
Public Class Calculator
Inherits MarshalByRefObject
Public Function GetThreadID() As Integer
Return Threading.Thread.CurrentThread.ManagedThreadId
End Function
Public Function GetTime() As String
Return Now.TimeOfDay.ToString
End Function
End Class
'Remoting host: Project name- SimpleHost (Console project), Module name- Module1, Configuration file name- app.config
Imports System.Runtime.Remoting
Module Module1
Sub Main()
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, False)
Console.Write("press enter to exit.")
Console.Read()
End Sub
End Module
'app.config code
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" type="SimpleLibrary.Calculator,SimpleLibrary" objecturi="Calculator.rem" />
</service>
<channels>
<channel ref="tcp" port="1212" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
'Client: Project name- SimpleClient (form project), form name-Form1.vb, configuration file name - app.config
'Form1.vb code
Imports System.Runtime.Remoting
Public Class Form1
Private Sub btnConfigureRemoting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConfigureRemoting.Click
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, False)
End Sub
Private Sub btnLocalThread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLocalThread.Click
MsgBox(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString)
End Sub
Private Sub btnRemoteThread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemoteThread.Click
Dim Calc As SimpleLibrary.Calculator = New SimpleLibrary.Calculator
MsgBox(Calc.GetThreadID.ToString)
End Sub
Private Sub btnGetTime_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetTime.Click
Dim Calc As SimpleLibrary.Calculator = New SimpleLibrary.Calculator
MsgBox(Calc.GetTime.ToString)
End Sub
End Class
'app.config code
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown mode="SingleCall" type="SimpleLibrary.Calculator,SimpleLibrary" url="tcp://localhost:1212/Calculator.rem" />
</client>
</application>
</system.runtime.remoting>
</configuration>
To use IIS as remoting host, i created a directory "test" under wwwroot and a directory "bin" under test directory. Then i put SimpleLibrary.dll in the bin directory and web.config file under test directory.
'web.config code
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" type="SimpleLibrary.Calculator,SimpleLibrary" objecturi="Calculator.rem" />
</service>
</application>
</system.runtime.remoting>
</configuration>
But when i test it in browser http://localhost/test/Calculator.rem?wsdl, it shows that page is not found. 192.168.1.4 is my server IP. Connected with my pc (IP-192.168.1.5) with LAN. Did i miss something ?
Help me please.
skpaul
'my SimpleClient app.config file code for IIS looks like
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown mode="SingleCall" type="SimpleLibrary.Calculator,SimpleLibrary" url="http://192.168.1.4/test/Calculator.rem" />
</client>
</application>
</system.runtime.remoting>
</configuration>