Click here to Skip to main content
15,903,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>
Posted
Comments
[no name] 3-Aug-11 10:29am    
I already suggested that learning Remoting is going to be of no use to you. Remoting is a deprecated technology. Instead, you can invest your time in learning WCF.
Sergey Alexandrovich Kryukov 3-Aug-11 13:01pm    
Remoting is not really deprecated (otherwise Microsoft would add a deprecated attribute). There are things which require greater flexibility and much better done in remoting. However, in this particular problem you may be right.
--SA
[no name] 3-Aug-11 14:51pm    
The link at 'http://msdn.microsoft.com/en-us/library/72x4h507%28VS.85%29.aspx' says: This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900