.NET Framework Developer Center >
.NET Development Forums
>
Windows Communication Foundation
>
WCF with basicHttpBinding over SSL
WCF with basicHttpBinding over SSL
- Hi,
I have several WCF services running properly over Http and as I would like to host them over https instead. However, I can't make it work!
When I log into my website and my app loads (it's in Silverlight), nothing happens.
I have my web.config configured as follows:
<system.serviceModel>
<services>
<service name="namepsace.Service1" behaviorConfiguration="namespace.DefaultBehavior">
<!-- Service Endpoints -->
<endpoint address="https://SERVER/Application/WcfServices/Service1"
binding="basicHttpBinding"
bindingConfiguration="sslConfig"
name="Service1.Https"
contract="namespace.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://SERVER/Application/WcfServices/Service1" />
</baseAddresses>
</host>
</service>
... 3 more services configured as above ..
<behaviors>
<serviceBehaviors>
<behavior name="namespace.DefaultBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="sslConfig">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Then in my ServiceReference.ClientConfig file inside my xap (my client is Silverlight)
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1.Https" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
... 3 more bindings defined for my other 3 services. configured same as this one ...
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://SERVER/Application/WcfServices/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="Service1.Https"
contract="namespace.IService1" name="BasicHttpBinding_IService1" />
... 3 more endpoints for the other services
</client>
</system.serviceModel>
</configuration>
Am I missing something here? Any help would be much appreciated.
Trevor
Answers
- Hi guys,
Thanks for your responses. After reading through the links you posted and several others, I finally got it working by adding the following to the <seviceMetaData> tag in each service behavior:
HttpsGetURL="https://SERVER/Application/WcfServices/Service1"
Everything is working beautifully for me now.
Thanks again,
Trevor- Marked As Answer byTrevor Ward Wednesday, November 04, 2009 6:54 PM
All Replies
- Greetings,
Link is given below
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/b361ee9e-2f37-4ecf-ba8b-96c6d6e6118a/
Hope this helps you out.
Take Care
PL
Helping People To Solve Technical Problems - Hi Trevor,
So after you change the binding to use https security, does the service correctly started or can you visit the baseAddress page(which should contains the WSDL metadata page)? YOu can also try to change the baseAddress to a different url from your endpoint url to see whether it works
If the metadata page works, what is the exact error you received when you call the https secured service? Set the includeExceptionDetailInFaults to "true" so as to get the detailed exception message at client-side.
http://icoder.wordpress.com/2007/06/22/how-to-setup-a-wcf-service-using-basic-http-bindings-with-ssl-transport-level-security/
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/b361ee9e-2f37-4ecf-ba8b-96c6d6e6118a/
Please remember to mark the replies as answers if they help and unmark them if they provide no help. - Hi guys,
Thanks for your responses. After reading through the links you posted and several others, I finally got it working by adding the following to the <seviceMetaData> tag in each service behavior:
HttpsGetURL="https://SERVER/Application/WcfServices/Service1"
Everything is working beautifully for me now.
Thanks again,
Trevor- Marked As Answer byTrevor Ward Wednesday, November 04, 2009 6:54 PM


