By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

vb.net error while registering evevents

P: n/a
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.

Jul 17 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
sh***********@gmail.com wrote:
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."
Remoting supports two "security levels" which controls the kinds of
objects that you can send across the "Great .Net Remoting Divide".
It sounds to me like you're running at the "lower" level, which only
supports basic, Framework-implemented types. You need to tell the
remoting server to use the "higher" one, so that you can serialise your
own Types as well.

I don't know which property it would be, but in the remoting
configuration file (which I use; I'm lazy) it would be specified as:
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="12345">
<serverProviders>
<formatter
ref="binary"
typeFilterLevel="Full" <-- this one!
/>
. . .

HTH,
Phill W.
Jul 17 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.