locked
Having one Http and one Https WCF service. RRS feed

  • Question

  • User-2146352328 posted

    Hi.

    I haven't implemented it yet but as i have tons of issues with setting the web service correct to the remote IIS i am asking ahead.

    I want to have both an http and an https WCF service(s) in my web.config.

    Now i am using 3.5 framework and nobody from microsoft bothered to notify that i needed to explicitly declare the url of the website in web config in order for WCF to work.

    (

    <serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix

    ...)

    Anyway http works now and am thinking of the frustration that i will get with https so i ask before.

    An i right to believe that i need to create another behavior in serviceBehaviors with httpsGetEnabled="true" and another

    webHttpsBinding

    with

    security mode="Transport"

    and finally add another prefix in

    baseAddressPrefixFilters

    with the same website only with an httpS intead of http?

    Will  this do the trick or i am missing something? Do i need to temper with the mex some more?

    ( i have this set:   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> )

    Thanks.

    Saturday, March 29, 2014 9:33 PM

Answers

  • User-417640953 posted

    Hi sapator,

    Thank you post the issue to our forum.

    Based on your description, I see you want to use the https in the endpoint address.

    ( i have this set:   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> )

    For the matedata endpoint, I think you should use the "mexHttpsBinding" like below.

    <endpoint address="https://localhost/WCFWSHttps/Service1.svc" binding="wsHttpBinding" 
       bindingConfiguration="TransportSecurity" contract="WCFWSHttps.IService1"/>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    

    Besides, we need to change httpGetEnabled to httpsGetEnabled.

    <serviceMetadata httpsGetEnabled="true"/>
    

    There is an article "Seven simple steps to enable HTTPS on WCF WsHttp bindings", please check it.

    http://www.codeproject.com/Articles/36705/simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 30, 2014 10:15 PM

All replies

  • User-417640953 posted

    Hi sapator,

    Thank you post the issue to our forum.

    Based on your description, I see you want to use the https in the endpoint address.

    ( i have this set:   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> )

    For the matedata endpoint, I think you should use the "mexHttpsBinding" like below.

    <endpoint address="https://localhost/WCFWSHttps/Service1.svc" binding="wsHttpBinding" 
       bindingConfiguration="TransportSecurity" contract="WCFWSHttps.IService1"/>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    

    Besides, we need to change httpGetEnabled to httpsGetEnabled.

    <serviceMetadata httpsGetEnabled="true"/>
    

    There is an article "Seven simple steps to enable HTTPS on WCF WsHttp bindings", please check it.

    http://www.codeproject.com/Articles/36705/simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 30, 2014 10:15 PM
  • User-2146352328 posted

    Thanks. I trust that it will work so i am closing this. IF i got any problems i will get back in another thread.

    Monday, March 31, 2014 11:44 PM