는이 서비스 나 인증서 (.PFX에게) 준과 암호 클라이언트에 의해 관리되고, 그래서 나는이에 대한 조작을 호출 할 필요가 서비스 그러나 나는 그것을 시험해 볼 때 약간 문제가있다.소비 WCF 서비스를 통해 HTTPS
어쩌면 내가 제대로 클라이언트와 서비스 간의 SSL 연결을 만들 아니에요, 난 내 Web.config를하고 서비스
web.config
전화 코드 조각을 보여줍니다 :
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="credentialConfiguration">
<clientCredentials>
<clientCertificate
findValue="10 14 08 f4 00 00 00 00 0f 3f"
storeLocation="CurrentUser"
x509FindType="FindBySerialNumber"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="myBinding">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://aaaaaaaaaaaaaaaaaa:700/aaa/aa/"
behaviorConfiguration="credentialConfiguration"
binding="wsHttpBinding"
bindingConfiguration="myBinding"
contract="mydll.service"
name="faturasSOAP" />
</client>
</system.serviceModel>
</configuration>
코드
내가 응답 서비스를 호출 할 때마다//Create authentication header
CdoHeaderCredentials header = GetEncryptedCredentials();
//Client Proxy
InvoiceService.faturasClient clientProxy = new faturasClient();
//Custom header
AddWseSecurityHeaderEndpointBehavior customEndpointBehavior =
new AddWseSecurityHeaderEndpointBehavior(header.Username, header.Password, header.Nonce, header.ClientDate);
clientProxy.Endpoint.Behaviors.Add(customEndpointBehavior);
//get document to register on service
RegisterInvoiceType documentToSnyc = manager.DocumentToSnyc();
//Load private certificate with key
X509Certificate2 cert = new X509Certificate2(
certPath,
_certKey,
X509KeyStorageFlags.Exportable);
//Link the certificate with the proxy
clientProxy.ClientCredentials.ClientCertificate.Certificate = cert;
//invoke operation
RegisterInvoiceResponse response = clientProxy.RegisterInvoice(new RegisterInvoiceRequest(documentToSnyc));
이 동일 : 서비스를 호출
,536,913을 63,210<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<s:Header xmlns:s="http://www.w3.org/2003/05/soap-envelope" />
<env:Body>
<env:Fault>
<env:Code>
<env:Value>
env:Receiver</env:Value>
</env:Code>
<env:Reason>
<env:Text xml:lang="en-US">
Internal Error (from server)
</env:Text>
</env:Reason>
</env:Fault>
</env:Body>
</env:Envelope>
내 질문이 오류는 클라이언트 인증을 던져 SSL에 대한, 또는 다른 어떤 경우입니까? 사전에
감사
덕분에, 그러나 나의 클라이언트는 이러한 상황에 대해하는 오류의 코드를 설립했다 몇 가지 매개 변수를 암호화해야합니다 요청을 인증 I'am 필요 의심하기 때문에, 문제가, 오류가이 암호화 된 매개 변수에서 오는 경우 나도 몰라한다 예 : (8 - 유효하지 않은 공개 키, 9 - 암호가 채워지지 않음, 11 - 대칭 키가 유효하지 않음). 보시다시피 이들 코드 중 하나도 반환되지 않습니다. – mastervv