这是远程对象
Public Class RemoteObject
Inherits MarshalByRefObject 'return the name of the current application domain
Public Function GetActiveDomain() As String Return AppDomain.CurrentDomain.FriendlyName
End Function
End Class这是SimpleClient的app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="SimpleClient">
<client url="tcp://localhost:8080/SimpleServer">
<activated type="RemoteObjects.RemoteObject,RemoteObjects"/>
</client>
<channels>
<channel ref="tcp client"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
这是一个简单的类
这是调用
RemotingConfiguration.Configure("SimpleClient.exe.config")
Dim RemoteObj As New RemoteObjects.RemoteObject //就这句报错了
高手帮忙看下,发了三个贴子了,没分了。。
Public Class RemoteObject
Inherits MarshalByRefObject 'return the name of the current application domain
Public Function GetActiveDomain() As String Return AppDomain.CurrentDomain.FriendlyName
End Function
End Class这是SimpleClient的app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="SimpleClient">
<client url="tcp://localhost:8080/SimpleServer">
<activated type="RemoteObjects.RemoteObject,RemoteObjects"/>
</client>
<channels>
<channel ref="tcp client"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
这是一个简单的类
这是调用
RemotingConfiguration.Configure("SimpleClient.exe.config")
Dim RemoteObj As New RemoteObjects.RemoteObject //就这句报错了
高手帮忙看下,发了三个贴子了,没分了。。
<configuration>
<system.runtime.remoting>
<application name="SimpleServer">
<service>
<actived type="RemoteObjects.RemoteObject,RemoteObjects"/>
</service>
<channels>
<channel ref="tcp server" port="8080"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>这是服务器端的app.config
多谢了
你必须在服务器中自己调用
RemotingConfiguration.Configure("YourServerApp.exe.config")
服务器端是这样写的:
Private Sub HostForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RemotingConfiguration.Configure("SimpleServer.exe.config")
End Sub
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="SimpleClient">
<client url="tcp://localhost:8080/SimpleServer">
<activated type="RemoteObjects.RemoteObject, RemoteObjects"/>
</client>
<channels>
<channel ref="tcp client" >
<!-- If you are using .NET 1.1 in conjunction with
a leasing sponsor, you must uncomment the lines below
to add support for full serialization. -->
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
总体做什么用,每部分做什么用,简要说明一下:)