Hi!,
I am developing a chat system using vb.net in vs 2005. I am getting
the following error while registering the events.
error details: System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See
Exception.InnerException for details. The error is: Type
System.DelegateSerializationHolder and the types derived from it (such
as System.DelegateSerializationHolder) are not permitted to be
deserialized at this security level."
Source="ChatApplication"
StackTrace:
at ChatApplication.My.MyProject.MyForms.Create__Insta nce__[T](T
Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at ChatApplication.My.MyProject.MyForms.get_Client()
at ChatApplication.Client.Main() in C:\tests\chatSol
\ChatApplication\Client.vb:line 8
at System.AppDomain.nExecuteAssembly(Assembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsof
details:
'----------------------------------Client
Imports System.Runtime.Remoting.Channels.Http
Public Class Client
Inherits System.Windows.Forms.Form
Private theManager As InBetween.Manager
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
Dim chan As HttpChannel = New HttpChannel("0")
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannel(chan)
theManager =
CType(Activator.GetObject(Type.GetType("InBetween. Manager,InBetween"),
"http://localhost:7777/ChatApplication"), InBetween.Manager)
AddHandler Me.theManager.evtReceiveText, AddressOf
Me.HandleReceivedMsg
end sub
#End Region
Sub HandleReceivedMsg(ByVal username As String, ByVal text As
String)
Me.txtReceivedMsgs.AppendText(username & " : " & text &
vbCrLf)
End Sub
end class
'-------------------------------------Server
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Http
Imports System.Runtime.Remoting
Imports System
Imports InBetween
public class Server
Public Shared Sub Main()
Dim server1 As Server
server1 = New Server()
End Sub
Public Sub New()
Dim chan As IChannel = New HttpChannel(7777)
ChannelServices.RegisterChannel(chan)
System.Runtime.Remoting.RemotingConfiguration.Regi sterWellKnownServiceType( _
Type.GetType("InBetween.Manager, InBetween"), _
"ChatApplication", WellKnownObjectMode.Singleton)
Dim Manager1 As New Manager()
Console.WriteLine("The Manager object's ID2:" &
Manager1.getHash())
System.Console.WriteLine("Hit ENTER to exit...")
System.Console.ReadLine()
End Sub
end class
'-------------------------------------Manager
Imports System
Public Delegate Sub ReceiveText(ByVal username As String, ByVal text
As String)
Public Class Manager
Inherits MarshalByRefObject
Public Event evtReceiveText As ReceiveText
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
Public Function SendText(ByVal username As String, ByVal text As
String)
RaiseEvent evtReceiveText(username, text)
End Function
End Class
Howerver, I can call the methods of remoting object.
Its very very urgent and I tried lot to resolve but i could not solve
this problem.
Please someone help me out and please suggest me if there are
alternative ways to resolve this.
Thanks.
Shivkumar S.