0

내가 원격 서버가 내가 스택 추적을 다음과 같이 예외를 얻을 이벤트를 구독하려고 event.When을 노출 한 원격 server..The와의 통신을 설립원격 서버와 통신하는 동안 예외가 발생 했습니까?

[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() 

다음과 같이 내 코드 블록은 다음과 같습니다 은 원격 서버의 구성은 아래와 같습니다 // 코드 우리는 서버와 래퍼없이 이벤트를 직접 등록 할 수 client..We와 통신하기 위해 래퍼 클래스를 필요로 분산 시스템의 경우

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

일부 코드에 대한 자세한 정보가 필요합니다. –

+0

더 많은 코드와 원격 구성을 게시해야합니다. – Carsten

+0

내 코드 블록이 추가되었습니다. 자세히 살펴보십시오. – Techy

답변

0

이 래퍼 cl 엉덩이는 클라이언트와 서버와 통신하는 매체 역할을합니다.