WCF SSL configuration error perhaps
Trying to get HelloWorld working via SSL. Read all these docs:
X509FindType
How to: Use wsHttpBinding with Windows Authentication and Transport Security in WCF Calling from Windows Forms
How to: Configure a Port with an SSL Certificate
How to: Create Temporary Certificates for Use During Development
Windows Communication Foundation (WCF) Screencasts
All I know is that the certificate seems to be created and deployed correctly (both certificates, actually). Still, I guess something is wrong with my web.config (sorry, can't be more specific at this point). It's like there is no server listening on 443 or client expects an http instead of https. Can someone please point me to the appropriate resource and/or tell what am I doing wrong?
The web.config is here:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="HTTPBaseAddress" value=""/>
</appSettings>
<system.serviceModel>
<services>
<service behaviorConfiguration="MyServiceTypeBehaviors" name="MyWCFServices.HelloWorldService">
<clear />
<endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint" contract="IMetadataExchange" listenUriMode="Explicit">
<identity>
<dns value="localhost" />
<certificateReference storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="" name="SSLendpoint" contract="MyWCFServices.IHelloWorldService">
<identity>
<dns value="localhost" />
<certificateReference x509FindType="FindByThumbprint" findValue="82a39faaeb18bf9585b334ca83264add3d5b26ee" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
The client-side app.config is here:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NoSecurity">
<security mode="None" />
</binding>
<binding name="SSLsecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
<message clientCredentialType="Certificate" /
</security>
开发者_如何学Python </binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:443/HelloWorldSSL/HelloWorldService.svc"
binding="wsHttpBinding" bindingConfiguration="" contract="IHelloWorldService"
name="wsHttpBinding_IHelloWorldService" />
</client>
</system.serviceModel>
</configuration>
If any additional info/screenshot is required - I'll happily provide it (as usual). Hope this is an answerable question :)
Your configuration is not correct. You are not definining custom binding configuration in your endpoint so HTTPS is not used. Use this one for the server:
<bindings>
<wsHttpBinding>
<binding name="SSLSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyServiceTypeBehaviors"
name="MyWCFServices.HelloWorldService">
<endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint"
contract="IMetadataExchange" listenUriMode="Explicit" />
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="SSLSecurity"
name="SSLendpoint" contract="MyWCFServices.IHelloWorldService" />
</service>
</services>
For client use:
<bindings>
<wsHttpBinding>
<binding name="SSLSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:443/HelloWorldSSL/HelloWorldService.svc"
binding="wsHttpBinding" bindingConfiguration="SSLSecurity"
contract="IHelloWorldService" name="wsHttpBinding_IHelloWorldService" />
</client>
精彩评论