2011-08-10 3 views
0

내가 WCF하고있는 wsHttpBinding을 사용하여 새로운 오전,하지만 난 (내가 통과해야) 서비스 클라이언트를 사용자 이름을 제거하고 암호를 형성 할은, 내 클라이언트 코드는WsHttpBinding과 클라이언트 인증

RServiceClient serviceClient = new RServiceClient(); 
serviceClient.ClientCredentials.Windows.ClientCredential.UserName = "UserName"; 
serviceClient.ClientCredentials.Windows.ClientCredential.Password = "Password"; 
입니다

이 사용자 이름과 암호를 전달하고 싶지 않습니다.

내 클라이언트의 app.config은 다음과 같습니다

 <binding name="WSHttpBinding_IRService" 
       closeTimeout="00:01:00" 
       openTimeout="00:01:00" 
       receiveTimeout="00:10:00" 
       sendTimeout="00:01:00" 
       bypassProxyOnLocal="false" 
       transactionFlow="false"  
       hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="524288" 
       maxReceivedMessageSize="65536" 
       messageEncoding="Text" 
       textEncoding="utf-8" 
       useDefaultWebProxy="true" 
       allowCookies="false"> 
       <readerQuotas maxDepth="32" 
          maxStringContentLength="8192" 
          maxArrayLength="16384" 
          maxBytesPerRead="4096" 
          maxNameTableCharCount="16384" /> 
       <reliableSession ordered="true" 
           inactivityTimeout="00:10:00" 
           enabled="false" /> 
       <security mode="Message"> 
       <transport clientCredentialType="Windows" 
          proxyCredentialType="None" 
          realm="" /> 
       <message clientCredentialType="Windows"      
         negotiateServiceCredential="true" 
         algorithmSuite="Default" /> 
       </security> 
      </binding> 

의식 이제 서비스는 웹에서 호스팅됩니다. service.config 또는 클라이언트 측 응용 프로그램 .config에 변경 사항이 있습니다. 내 약한 지식에 googleing 후 클라이언트 측 변경해야하지만 그럴 수 없습니다. :-(

참고 :.. 내 계약이 너무 세션을 필요로 사전에 고맙습니다 당신은 서버 측에서의 web.config를 변경해야

답변

0

, 클라이언트의 web.config가 자동으로 새로 고침 후 업데이트됩니다 로그인/암호를 사용하지 않으려면 상호 인증서 인증을 설정하라는 조언을받을 수 있습니다.

이 방법은 다른 WS 스택 (예 : Java CXF, ..)과 보안 및 상호 운용이 가능합니다. .)

상호 인증의 경우 : X.509 인증서를 사용하면 클라이언트가 실제로 서버가 누구인지 그리고 클라이언트 측에서 다른 X.509 인증서가 있는지 확인할 수 있습니다. 여기

MSDN에서의 Web.config의 예, 더 많은 정보 :

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="serviceCredentialBehavior"> 
      <serviceCredentials> 
      <serviceCertificate findValue="Contoso.com" 
           storeLocation="LocalMachine" 
           storeName="My" 
           x509FindType="FindBySubjectName" /> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service behaviorConfiguration="serviceCredentialBehavior" 
       name="ServiceModel.Calculator"> 
     <endpoint address="http://localhost/Calculator" 
        binding="wsHttpBinding" 
        bindingConfiguration="InteropCertificateBinding" 
        name="WSHttpBinding_ICalculator" 
        contract="ServiceModel.ICalculator" /> 
     </service> 
    </services> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="InteropCertificateBinding"> 
      <security mode="Message"> 
      <message clientCredentialType="Certificate" 
        negotiateServiceCredential="false" 
        establishSecurityContext="false" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client /> 
    </system.serviceModel> 
</configuration> 
+0

내가 요구하고있는 무슨 이잖아, service.config의 변화는 무엇인가? 이 내 설정이다. <는 system.serviceModel> <동작 이름 = "RServiceBehavior"> <서비스 behaviorConfiguration = "RServiceBehavior 'NAME ="EHRService "><엔드 포인트 주소 =" "바인딩 ="있는 wsHttpBinding "계약 ="ServiceContracts.IRService "> user765573

관련 문제