2011-03-29 7 views
0

WCF를 사용하여 MSMQ (net.msmq 프로토콜)를 통해 메시지를 보냅니다. BizTalk Server는 메시지를 받고 처리합니다. 그러나 SVCLOG를 살펴보면 MsmqProtectionLevel을 Sign으로 설정하면 메시지가 암호화 된 것을 볼 수 있습니다.서명이 지정되면 WCF 메시지 (net.msmq) 암호화

이 동작을 본 사람이 있습니까? 암호화를 중지 할 수 있습니까? 일부 메시지가 1MB 이상이고 암호화로 인해 실제 속도가 느려집니다.

미리 감사드립니다.

ChannelFactory<OnRampEntry> Factory 
    { 
    get 
    { 
     if (factory == null) 
     { 
      lock (this) 
      { 
       if (factory == null) 
       { 
       var uri = ResolveQueueName(new Uri(Url)); 
       var identity = EndpointIdentity.CreateDnsIdentity(BizTalkIdentity); 
       var binding = new NetMsmqBinding(NetMsmqSecurityMode.Both) 
       { 
        DeadLetterQueue = DeadLetterQueue.System, 
        ExactlyOnce = true 
       }; 
       binding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; 
       binding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.Sign; 
       binding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.WindowsDomain; 
       binding.Security.Transport.MsmqSecureHashAlgorithm = MsmqSecureHashAlgorithm.Sha1; 
       factory = new ChannelFactory<OnRampEntry>(binding, new EndpointAddress(uri, identity, (AddressHeaderCollection) null)); 
       factory.Endpoint.Behaviors.Add(new LogonCertificateBehavior()); 
       factory.Credentials.ServiceCertificate.SetDefaultCertificate(StoreLocation.LocalMachine, StoreName.TrustedPeople, X509FindType.FindBySubjectName, BizTalkIdentity); 
       factory.Open(); 
       } 
      } 
     } 
     return factory; 
    } 
    } 

    /// <summary> 
    /// MSMQ does not allow a DNS alias to be used in a queue name, e.g. "net.msmq://alias/private$/queue". 
    /// <b>ResolveQueueName</b> will tranlsate an alias to its actual machine name. 
    /// </summary> 
    /// <param name="uri"></param> 
    /// <returns></returns> 
    Uri ResolveQueueName(Uri uri) 
    { 
    var hostName = uri.DnsSafeHost; 

    try 
    { 
     var hostEntry = Dns.GetHostEntry(hostName); 
     var resolved = new Uri(uri.ToString().Replace(hostName, hostEntry.HostName)); 

     if (log.IsDebugEnabled) 
      log.Debug(string.Format("Resolved '{0}' to '{1}'.", uri, resolved)); 
     return resolved; 
    } 
    catch (SocketException e) 
    { 
     if (e.SocketErrorCode == SocketError.HostNotFound) 
      return uri; 
     throw e; 
    } 
    } 

답변

1

암호화 된 메시지가 NetMsmqSecurityMode.Both를 사용하는 것입니다 이유 - 전송 및 메시지 보안을 모두. 전송 수준에서

var binding = new NetMsmqBinding(NetMsmqSecurityMode.Both) 

는 구성은 위의

binding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.Sign; 

WCF에서 찾고 그것을 메시지 레벨의 암호화 장소에서와 같이, 전송 수준에서 설정 상황을 확인하기 위해 할 수 없습니다 로그를 사용합니다.

불행히도이 메시지는 인증서를 사용하여 메시지 본문을 암호화하지 않고 메시지에 서명하는 방법 (X.509 인증서 사용)에 대한 대답이 아닙니다.