Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:43:33+00:00 2026-06-06T00:43:33+00:00

I have established communication with a remote server..The remote server has exposed an event.When

  • 0

I have established communication with a remote server..The remote server has exposed an event.When i try to subscribe for the event i get the exception with following stack trace

    [System.Reflection.TargetInvocationException] 
    = {"Exception has been thrown by the target of an invocation."}

    [System.Reflection.TargetInvocationException] 
    = {"Exception has been thrown by the target of an invocation."}
    at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
    at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
    Boolean throwOnFileNotFound, Boolean forIntrospection)
    at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
    at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)\r\n
    at System.Reflection.Assembly.Load(String assemblyString)
    at System.Reflection.MemberInfoSerializationHolder..ctor(SerializationInfo info, StreamingContext context)

    StackTrace          
    Server stack trace: 
    at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
    at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)
    at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context) 
    at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
    at System.Runtime.Serialization.ObjectManager.DoFixups()
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
    at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

    Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at Mycode.Method(EventHandler value)
    at Mysource.Initialize()

My code block is as follows:
The configuration for remoting server is given below
//code

TurnOffRemotingExceptionFiltering();

BinaryClientFormatterSinkProvider^ clientProvider = nullptr;
BinaryServerFormatterSinkProvider^ serverProvider = gcnew aryServerFormatterSinkProvider();
serverProvider->TypeFilterLevel = TypeFilterLevel::Full;
System::Collections::IDictionary^ props = gcnew Hashtable();
props["port"] = port;
String^ guid = System::Guid::NewGuid().ToString();
props["typeFilterLevel"] = TypeFilterLevel::Full;

//TcpChannel
channel = gcnew TcpChannel(props, clientProvider, serverProvider);
ChannelServices::RegisterChannel(channel, false);
props["name"] = guid;

void RemoteConnectionManager::TurnOffRemotingExceptionFiltering()
{
                 // Gets the assembly in which the 'System.Runtime.Remoting.RemotingConfiguration' is defined.
                Assembly^ remoting = Assembly::GetAssembly(RemotingConfiguration::typeid);

                // Gets the Type object of 'System.Runtime.Remoting.CustomErrorsModes' from assembly instance.
                Type^ customErrorsModes = remoting->GetType("System.Runtime.Remoting.CustomErrorsModes");

                // Gets the Type object of 'System.Runtime.Remoting.RemotingConfigHandler' from assembly instance.
                Type^ remotingConfigHandler = remoting->GetType("System.Runtime.Remoting.RemotingConfigHandler");

                // Gets details of '_errorMode' field.'_errorMode' indicates whether the server channels in 
                // this application domain return filtered or complete exception information to local or remote callers.
                FieldInfo^ errorMode = remotingConfigHandler->GetField("_errorMode",
                                        BindingFlags::Static | BindingFlags::NonPublic);

                // Gets details of 'Off' field.'System.Runtime.Remoting.CustomErrorsModes' is an Enumeration
                FieldInfo^ mode = customErrorsModes->GetField("Off");

                // Sets "Off" to get to get complete exception information 
                // from server channels to to local or remote callers.
                errorMode->SetValue(nullptr, mode->GetValue(nullptr));
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:43:35+00:00Added an answer on June 6, 2026 at 12:43 am

    In case of distributed systems we need a wrapper class to communicate with the server and the client..We cannot subscribe directly for an event without a wrapper class..This wrapper class acts as a medium to communicate with the client and the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After the connection has been established, and the two sides have no communication, which
I have to establish a TLS connection to a remote server with a preshared
Right now I have a communication infrastructure compose of a client and server. The
I have a web page that establishes communication with a node.js server. I am
I have a client-server communication in Python. If I'm sending 10MB data from the
I have the following situation: Windows Server environment with multiple user sessions. Windows Service
I have a plug-in vector established using System.AddIn that accepts the body of a
I have an ASP.NET MVC website where I've established a system of Permissions. There
.NET's ProviderBase was established in the 2.0 release of the .NET Framework. Have there
I have requirements to establish a CMS system for enterprise and it has to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.