Error while registering the events on client side appl.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shivkumar2004@gmail.com

    #1

    Error while registering the events on client side appl.

    Hi,

    I m getting the following error while registering the events on client
    appl.
    error:
    "An error occurred creating the form. See Exception.Inner Exception 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 BinaryServerFor matterSinkProvi der
    Dim clientProv As New BinaryClientFor matterSinkProvi der
    Dim props As IDictionary = New Hashtable
    serverProv.Type FilterLevel =
    System.Runtime. Serialization.F ormatters.TypeF ilterLevel.Full
    props("port") = 0
    'props("name") = "ChatApplicatio n"
    chan = New HttpChannel(pro ps, clientProv, serverProv)
    ChannelServices .RegisterChanne l(chan, False)

    theManager =
    CType(Activator .GetObject(Type .GetType("InBet ween.Manager,In Between"),
    "http://localhost:7777/ChatApplication "), InBetween.Manag er)

    AddHandler Me.theManager.e vtReceiveText, AddressOf
    Me.HandleReceiv edMsg

    '-----------------manager
    Public Delegate Sub ReceiveText(ByV al username As String, ByVal text
    As String)

    Public Class Manager
    Inherits MarshalByRefObj ect

    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 BinaryServerFor matterSinkProvi der
    Dim clientProv As New BinaryClientFor matterSinkProvi der
    Dim props As IDictionary = New Hashtable
    serverProv.Type FilterLevel =
    System.Runtime. Serialization.F ormatters.TypeF ilterLevel.Full
    props("port") = 7777
    'props("name") = "ChatApplicatio n"
    chan = New HttpChannel(pro ps, clientProv, serverProv)
    ChannelServices .RegisterChanne l(chan, False)

    RemotingConfigu ration.Register WellKnownServic eType( _
    Type.GetType("I nBetween.Manage r, InBetween"), _
    "ChatApplicatio n", WellKnownObject Mode.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

Working...