none
Set up WCF service with both http and https endpoint RRS feed

  • Question

  • Hi Everyone,

    I have limited experience with WFC, and I would like to set my service to run with both http and https endpoints on separate ports. I set up the bindings in IIS, and I can access the service site on both. I also set two separate endpoints with separate bindings in app.config. However, I get the following error when I call the service from code: "The provided URI scheme 'https' is invalid; expected 'http'.  Parameter name: via". Do you have any ideas what might be wrong?

    Also, when I browse the site at the https endpoint, I see the link with wsdl reference to the http site. Is it how it is supposed to happen?

    Regards,

    Adam

    • Moved by Fred Bao Tuesday, January 12, 2016 1:18 AM wcf related
    Monday, January 11, 2016 12:53 PM

Answers

  • Hi,

    >>provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via

    PLease try to add <security mode="transport"> to the binding on the web service

    <wsHttpBinding>
             <binding name="WSHttpBinding_WVSLEXSService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"
               <security mode="Transport"></security>
             </binding>
    </wsHttpBinding>

    If you do modify the service binding, you will need to update the service reference on the web

    app to ensure it now knows that the expected scheme is https.

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    • Marked as answer by Adam Borsik Tuesday, January 12, 2016 11:26 AM
    Tuesday, January 12, 2016 6:24 AM
    Moderator

All replies

  • Hello Adam

    Since this issue is related with WCF, I move it to the WCF forum for getting better support. The current forum you post to is for WCF Data Service.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 12, 2016 1:18 AM
  • Hi,

    >>provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via

    PLease try to add <security mode="transport"> to the binding on the web service

    <wsHttpBinding>
             <binding name="WSHttpBinding_WVSLEXSService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"
               <security mode="Transport"></security>
             </binding>
    </wsHttpBinding>

    If you do modify the service binding, you will need to update the service reference on the web

    app to ensure it now knows that the expected scheme is https.

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    • Marked as answer by Adam Borsik Tuesday, January 12, 2016 11:26 AM
    Tuesday, January 12, 2016 6:24 AM
    Moderator
  • Hi,

    Thanks for the help. The security mode was added correctly, but I did not update the reference in my code. After the update it worked as expected.

    Regards,

    Adam

    Tuesday, January 12, 2016 9:03 AM
  • Hi Adam,

    can you provide the web.config where you made it to support http and https, i am running into same issue, where https works fine, but http throws- 

    HTTP Error 403.4 - Forbidden

    error, i know this is 3 years old thread hope to get a reply from you.

    i want to support my wcf service work with both protocol.

    Thursday, April 25, 2019 8:21 AM