1

I'm working with a WCF Service hosted in IIS however when i try navigate to the endpoint i receive the error "The protocol 'https' is not supported". It's hosted in IIS 10 locally running Windows 10.

The service is using wsHttpBinding with TransportWithMessageCredential.

Is this error something to do with the SSL certificate or IIS?

I already have a valid localhost certificate in my Local Machine > Personal certificate store.

What I've tried so far

  1. Set the httpsGetUrl attribute to the .svc endpoint.
  2. Checked IIS setting and default protocols is set to "http" which means both http and https protocols are enabled.
  3. Checked that the Application Pool is using .NET Framework 4.0
  4. Restarted the application pool

I appreciate if someone can assist me.

Here is the current config:

    <?xml version="1.0"?>
    <configuration>
    <system.web>
    <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
    <services>
        <service name="XXX.Zoo.WebServices.ZooServices_3_0" 
      behaviorConfiguration="ZooServices_3_0_Behavior">
            <endpoint
                address="https://localhost/Zootest_3_0/ZooServices_3_0.svc"
                binding="wsHttpBinding"
                bindingConfiguration="ZooServices_3_0_Binding"
                contract="XXX.Zoo.WebServices.IZooServices_3_0" />
            <endpoint

          address="https://localhost/Zootest_3_0/ZooServices_3_0.svc/mex"
                binding="mexHttpsBinding"
                contract="IMetadataExchange" />
        </service>
        </services>
       <bindings>
        <wsHttpBinding>
            <binding name="ZooServices_3_0_Binding"
                maxReceivedMessageSize="2147483647"
                maxBufferPoolSize="2147483647" >
                <readerQuotas
                    maxDepth="2147483647"
                    maxStringContentLength="2147483646"
                    maxArrayLength="2147483647"
                    maxBytesPerRead="2147483647"
                    maxNameTableCharCount="2147483647"/>
                <security mode="TransportWithMessageCredential">
                    <transport clientCredentialType="None" 
                     proxyCredentialType="None" realm="" />
                    <message clientCredentialType="Certificate" 
              negotiateServiceCredential="true" algorithmSuite="Default" 
              establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
      </bindings>
        <behaviors>
        <serviceBehaviors>
            <behavior name="ZooServices_3_0_Behavior">
                <serviceMetadata httpsGetEnabled="true" 
           httpsGetUrl="https://localhost/Zootest_3_0/ZooServices_3_0.svc" />
                <serviceDebug includeExceptionDetailInFaults="False" />
                <!--The serviceCredentials behavior defines a service 
                  certificate which is used by the service to authenticate 
              itself to  its clients and to provide message protection. -->
                <serviceCredentials>
                    <serviceCertificate
                        findValue="localhost"
                        storeLocation="LocalMachine"
                        storeName="My"
                        x509FindType="FindBySubjectName" />
                    <clientCertificate>
                        <authentication 
                      certificateValidationMode="ChainTrust"/>
                    </clientCertificate>
                </serviceCredentials>
            </behavior>
                 </serviceBehaviors>
            </behaviors>        
          </system.serviceModel>
       </configuration>
KI1
  • 907
  • 1
  • 13
  • 31
  • For enabling the https protocol, you should enable the https protocol in the IIS site binding module and add https service endpoint which uses transport layer security mode to the service. – Abraham Qian Jan 08 '19 at 09:48
  • Technically, HTTPS is not a protocol but a scheme. The protocols are HTTP and TLS. – Liga Nov 26 '19 at 09:18

2 Answers2

0

This particular error was resolved by removing the httpsGetUrl attribute from the configuration:

httpsGetUrl="https://localhost/Zootest_3_0/ZooServices_3_0.svc

So the end result looks like this:

<serviceMetadata httpsGetEnabled="true"/>
KI1
  • 907
  • 1
  • 13
  • 31
0

If you want to enable the https protocol support, you should add the https endpoint which use transport transfer mode to the service. Then we should set up the https protocol site binding in the IIS site binding module.
enter image description here
I have made a demo, wish it is useful to you.
Server end.

   [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        string GetData(int value);     
        }
    public class Service1 : IService1
    {

        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }
    }

Web.config

<system.serviceModel>
    <services>
      <service name="WcfService1.Service1" behaviorConfiguration="mybehavior">
        <endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" bindingConfiguration="https"></endpoint>
        <endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" bindingConfiguration="http"></endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="https">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
        <binding name="http">
          <security mode="None">
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mybehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

IIS.
enter image description here
Here are some links, wish it is useful to you.
WCF Service not hitting from postman over https
https://social.msdn.microsoft.com/Forums/vstudio/en-US/d42fc165-052d-476a-9580-1240b3d0293d/specify-endpoint-in-wcf-webconfig?forum=wcf
Feel free to let me know if there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22