Windows 클라이언트가 사용하고 사용할 HTTP wcf 서비스를 만들었습니다. 내가 HTTP를 사용할 때까지 나는 아무런 문제도 없었다. 이제 고객이 사이트를 HTTPS로 변경하려고합니다. 따라서 개발 목적으로 IIS express 인증서를 사용하고 서비스를 설정했습니다. 이제 iisexpress 자체 서명 인증서로 IIS에서 서비스가 실행 중입니다. 브라우저 및 wcf 테스트 클라이언트 도구를 통해 새로운 https 서비스를 검색 할 수 있습니다.http에서 https로 변경 한 후 클라이언트에서 메서드를 호출하면 WCF 서비스에서 오류를 반환합니다. "ContractFilter EndpointDispatcher에서 일치하지 않습니다."
하지만 내 Windows 응용 프로그램에서 새 https wcf 서비스로 메소드를 호출 해 봅니다. 내 서비스 인스턴스가 만들어집니다 만 메소드를 호출하는 동안 나는 오류 다음 얻을 : 내 바인딩 설정 (설정 3 HTTPS 모드 설정 (2)는 HTTP 모드에서 사용에서 사용되는) 서비스에서
System.ServiceModel.ActionNotSupportedException was unhandled by user code HResult=-2146233087 Message=The message with Action ' http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence ' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
가 같다 다음 : 클라이언트에서
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_IPGPService">
<!--config test 1 - start -->
<!--<security mode="None">
<transport clientCredentialType="None" />
<message establishSecurityContext="false" />
</security>-->
<!--config test 1 - end -->
<!--config test 2 - start -->
<!--<security mode="None" />
<reliableSession enabled="true" />-->
<!--config test 2 - end -->
<!--config test 3 - start -->
<!--<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"/>
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>-->
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
<!--config test 3 - end -->
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="PGPService.PGPService">
<endpoint address="" binding="wsHttpBinding" contract="PGPService.IPGPService" bindingConfiguration="wsHttpBinding_IPGPService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<!--<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<!--<serviceDebug includeExceptionDetailInFaults="false"/>-->
<!--test config - start-->
<serviceDebug includeExceptionDetailInFaults="True" />
<!--test config - end-->
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
우리는 서비스 인스턴스를 생성하는 사용자 정의 바인딩을 사용. 서비스를 추가 한 후
url = "https://localhost:550/TestService/TestService.svc";
customBinding = new CustomBinding();
customBinding.Elements.Add(new ReliableSessionBindingElement());
customBinding.Elements.Add(new HttpsTransportBindingElement());
EndpointAddress endpointAdress = new EndpointAddress(url);
pgpServiceClientInstance = new PGPServiceClient(customBinding, endpointAdress);
pgpServiceClientInstance.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.CurrentUser,
StoreName.Root,
X509FindType.FindByThumbprint,
"03815c894b62dcf2d17336ade2d9ca61ddb7f92c");
다음과 같이 내 Windows 응용 프로그램에 생성의 app.config은 참조 :
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IPGPService">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:550/TestService/TestService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPGPService"
contract="PGPServiceReference.IPGPService" name="WSHttpBinding_IPGPService" />
</client>
그래서 지금은 내 서비스 인스턴스가 성공적으로 만들어지고 볼 수 있습니다. 메소드를 호출 할 때 오류가 발생합니다.
서비스 종료시 https로 이동하기 전후에 코드가 변경되지 않았습니다. 그것은 동일한 서비스 코드입니다. 그것은 http에서 완벽하게 작동했지만 https에서는 깨졌습니다.
wcf 서비스 https를 만든 후 서비스 참조를 완전히 제거하고 새로 추가했습니다. IIS Express 자체 서명 인증서가 이미 설치되어 있으며 시스템에서 사용할 수 있습니다. 서비스와 클라이언트 모두 현재 개발 중이므로 동일한 시스템에서 실행 중임
구성 문제가 있다고 의심됩니다.하지만 경험이 부족하여 알아낼 수 없었습니다.
"HTTPS를 사용하여 IIS에서 사이트에 바인딩을 추가 했습니까?"라는 질문에 대한 답변을 받았습니다 (의견이 있어야 함). 좋은 질문 인 것처럼 들리므로 댓글에 답하십시오. 답변은 당연히 삭제 될 것입니다. – halfer
HTTPS를 사용하여 IIS의 사이트에 바인딩을 추가 했습니까? – Parag
예 바인딩이 https를 지원하도록 IIS에 추가되었습니다. 내 문제는 코드 현명하고 바인딩을 관련이 있었다. 아래 답변 포함 –