2016-07-25 10 views
0

서버에서 호스팅되는 웹 서비스 (클라이언트는 호스트 서버)와 통신하는 클라이언트 응용 프로그램이 있습니다. 클라이언트 응용 프로그램은 basicHttpBinding을 사용하여 잘 작성하고 연결할 수 있습니다. 그러나 보안상의 이유로 wsHttpBinding을 보충하려고합니다.WsHttpBinding이있는 클라이언트 응용 프로그램에서 "수신 대기하는 끝 점이 없습니다."

지난주 점심 식사 전에 하드 코딩 된 인증서로 작업하고 있다고 맹세 할 수있었습니다. 점심 식사에서 돌아와서 내 코드를 확인했는데 이제 실행되지 않습니다. 나는 계속 "메시지를 수락 할 수있는 https://hostServer:1234/Service.svc/MyServiceName에서 수신하는 엔드 포인트가 없습니다. 이것은 종종 잘못된 주소 또는 SOAP 조치로 인해 발생합니다." 내 설정을 다시 확인해 보았지만 내 단계를 되돌아 보았지만 제대로 작동하지 않는 상태로 돌아갈 수는 없었습니다.

주소가 "https : // hostServer : 1234/Service.svc? singleWsdl ". 문제없이 "https : // hostServer : 1234/Service.svc"로 이동하여 Wsdl을 볼 수 있습니다.

내 클라이언트 코드

WSHttpBinding wsBinding = new WSHttpBinding(SecurityMode.Transport); 
wsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; 

Client = new MyServiceName(wsBinding, new EndpointAddress(endpoint)); 

Client.ClientCredentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser, 
    StoreName.My, 
    X509FindType.FindBySubjectName, 
    "localCertName"); 

Client.ChangePassword("test_user", "pt", "a1"); 

내 값 엔드 포인트입니다 = https://hostServer:1234/Service.svc/MyServiceName 내 IIS 사이트는

(올바른 IP & 포트 ID로) HTTP 및 HTTPS에 대한 바인딩으로 설정되어

이 코드를 제거하기 전에이 코드를 작동시켜야합니다. (제 아내는 언젠가 우리 두 번째 아이와 만날 예정입니다). 나는 2 일 동안 이것을 디버깅하기 위해 일하고 있었다. 도와주세요.

답변

0

그래서 마침내이 작업을 다시 수행 할 수있었습니다. 아래에서 수행 된 단계가 다른 사람을 도울 수 있기를 기대하면서 목록으로 작성하십시오. IIS 서버 (IIS 관리자)에

:

수정 "사이트 바인딩" "SSL 필요"와 "동의하는 HTTP & HTTPS

(다른 포트 번호/w)을 설정 SSL 설정을 포함합니다 "IIS 서버에서

(의 Web.config) :

추가

<bindings> 
    <wsHttpBinding> 
    <binding name="wsHttpEndpointBinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType ="Certificate"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

"System.ServiceModel"태그.

또한 '끝점에 bindingConfiguration = "wsHttpEndpointBinding"을 추가했습니다. 코드

에서

는 IIS 서버에서 생성 된 것을 사용하는 엔드 포인트 주소를 업데이트했습니다.

엔드 포인트

WSHttpBinding wsBinding = new WSHttpBinding(SecurityMode.Transport); 
    wsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; 
    Client = new ServiceClient(wsBinding, new EndpointAddress(endpoint)); 
    Client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMac‌​hine, StoreName.My, X509FindType.FindByIssuerName, certName); 
를 만들기 위해 다음 코드를 사용