문제

WCF 서비스를 사용하여 서로를 전달하는 두 개의 웹 응용 프로그램에 문제가 있습니다. 이것이 내 시나리오입니다.

  • 웹 응용 프로그램 "A"는 회사 인트라넷의 서버와 도메인 "인트라넷"의 일부에 배포됩니다.
  • 웹 애플리케이션 "B"는 DMZ 서버에 배포되어 인터넷과 도메인 "엑스트라 넷"의 일부에 노출됩니다.
  • 방화벽은 두 도메인 사이에 있으며 신뢰 관계가 없습니다.
  • "A"는 WSHTTPBinding을 사용하여 "B"로 일부 WCF 서비스를 호출합니다.
  • "B"의 WCF 서비스는 IIS의 SSL에 따라 전송 안전합니다.
  • "A"를 인증하기 위해 사용자 이름 인증 동작을 사용하고 있습니다.

이것은 서버 바인딩 구성입니다.

">

<binding name="UsernameWithTransport">
  <security mode="TransportWithMessageCredential">
    <message clientCredentialType="UserName"
      negotiateServiceCredential="false" />
  </security>
</binding>   </wsHttpBinding>

"생산과 같은 두 가지 도메인이있는 테스트 환경에서 모든 것이 잘 작동하는 것 같습니다. 그럼에도 불구하고 생산 환경에서는"A "호출"B "가 다음과 같은 경우에 매번 추악한 오류가 발생합니다.


    System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: An error occurred when verifying security for the message.

Server stack trace: 
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

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)

먼저 10 분의 차이로 시계를 변경하여 테스트 환경에서 동일한 예외를 재현 할 수 있기 때문에 서버 간의 시계 동기화 문제라고 생각했습니다. 불행히도 이것은 프로덕션 서버가 동기화되기 때문에 문제가되지 않는 것 같습니다.

모든 정보가 감사하겠습니다 !!

도움이 되었습니까?

해결책

마지막으로 우리는 문제를 해결할 수 있었고, 앱 풀 아이덴티티는 권한 부족으로 인해 "c : windows temp"에 글을 쓸 수 없다는 것이 었습니다.

MessageEcurityException은 일반적인 예외이며 많은 문제에 대해 던질 수있는 것 같습니다. 실제 예외를 알기 위해 서비스 구성을 위해 ServiceBug 동작을 추가하고 EventViewer가 오류에 대한 자세한 정보를 확인하십시오.

디버그 구성입니다.


<serviceBehaviors>
<behavior name="ServiceBehavior">
 <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
 <serviceDebug includeExceptionDetailInFaults="true" />
 <serviceSecurityAudit auditLogLocation="Application"
  suppressAuditFailure="false"
  serviceAuthorizationAuditLevel="None"
  messageAuthenticationAuditLevel="SuccessOrFailure" />
</behavior>


어쨌든 감사합니다!

다른 팁

익명, 사용자 이름 또는 인증서 클라이언트 자격 증명 유형의 경우이 속성 [협상 서비스 인증]을 False로 설정하면 서비스 인증서를 대역에서 클라이언트에서 사용할 수 있어야하며 클라이언트가 사용할 서비스 인증서를 지정해야 함을 의미합니다.

http://msdn.microsoft.com/en-us/library/system.servicemodel.messagesecurityoverhttp.negotiateservicecredential.aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top