웹 서비스에 연결하기 위해 WCF 클라이언트에서 SSL 및 HTTP 인증을 사용해야합니다. 아래에 표시된대로 wcf 클라이언트 바인딩 구성과 인증서를로드하고 http 인증을위한 사용자 이름과 암호를 전달하는 코드가 있습니다. 이 시도했을 때 "http 요청이 클라이언트 인증 스키마 '익명'으로 인증되지 않았습니다. 서버의 인증이 '기본 영역 ="ws.dataway.com:443 ""이었습니다. 원격 서버가 오류 :.? (401) 권한이없는 사람은이 문제를 해결하고 무엇 바인딩 구성을 변경해야 감사하는 방법을 알려 주시기 바랍니다 수SSL 및 HTTP 인증을 사용하는 WCF 클라이언트에서 사용할 보안 모드는 무엇입니까?
<basicHttpBinding>
<binding name="OrderBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Certificate" proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
코드 :!
ClientCredentials loginCredentials = new ClientCredentials();
loginCredentials.UserName.UserName = this.UserId;
loginCredentials.UserName.Password = this.Password;
loginCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByIssuerName, "link.com");
var defaultCredentials = channelFactory.Endpoint.Behaviors.Find<ClientCredentials>();
channelFactory.Endpoint.Behaviors.Remove(defaultCredentials);
channelFactory.Endpoint.Behaviors.Add(loginCredentials);
클라이언트 인증서와 기본 인증을 모두 사용하고 있습니까? –
예, 웹 서비스 문서에서는 wcf 클라이언트가 보안을 위해 클라이언트 인증서를 제공해야하며 웹 서비스에 대한 모든 호출에 대해 HTTP 기본 인증이 필요하다고 말합니다. 감사! – Jyina
감사! wcf 클라이언트에서 인증서 및 HTTP 기본 권한을 지정할 수 있습니까? – Jyina