Hi,
I m getting the following error while registering the events on client
appl.
error:
"An error occurred creating the form. See Exception.InnerException for
details. The error is: Exception has been thrown by the target of an
invocation."
'My Coding
'---------client
Dim chan As HttpChannel
Dim serverProv As New BinaryServerFormatterSinkProvider
Dim clientProv As New BinaryClientFormatterSinkProvider
Dim props As IDictionary = New Hashtable
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilter Level.Full
props("port") = 0
'props("name") = "ChatApplication"
chan = New HttpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(chan, False)
theManager =
CType(Activator.GetObject(Type.GetType("InBetween. Manager,InBetween"),
"http://localhost:7777/ChatApplication"), InBetween.Manager)
AddHandler Me.theManager.evtReceiveText, AddressOf
Me.HandleReceivedMsg
'-----------------manager
Public Delegate Sub ReceiveText(ByVal username As String, ByVal text
As String)
Public Class Manager
Inherits MarshalByRefObject
Public Event evtReceiveText As ReceiveText
'-----------------server
public class Server
Public Shared Sub Main()
Dim server1 As Server
server1 = New Server()
End Sub
Public Sub New()
Dim chan As IChannel
Dim serverProv As New BinaryServerFormatterSinkProvider
Dim clientProv As New BinaryClientFormatterSinkProvider
Dim props As IDictionary = New Hashtable
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilter Level.Full
props("port") = 7777
'props("name") = "ChatApplication"
chan = New HttpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(chan, False)
RemotingConfiguration.RegisterWellKnownServiceType ( _
Type.GetType("InBetween.Manager, InBetween"), _
"ChatApplication", WellKnownObjectMode.Singleton)
Dim Manager1 As New Manager()
System.Console.WriteLine("Hit ENTER to exit...")
System.Console.ReadLine()
And one more thing is, I have copied the server.exe in C:\Inetpub
\wwwroot and before running client application, I have to double click
server.exe and run it. how to make it run automatically whenever any
client application starts. And can I use class library instead of
console application.
Thanks,
Shivkumar