How To Transform my HTTP windows service to HTTPS

Viewed 20

I'm struggling passing our windows services deployed on a server from HTTP to HTTPS.

How should we proceed?

<system.serviceModel>
<!--Conf HTTP-->
<client>      
  
  <endpoint address="http://localhost/WorkflowsService"
    binding="customBinding" bindingConfiguration="UserNameOverTransportBindingConfiguration"
    contract="OmmoComponents.Workflows.Common.Contracts.IWorkflowsService"
    name="WorkflowsServiceEndPoint"/>      
  
  
  <endpoint address="http://localhost/OMVGestionService" binding="customBinding"
    bindingConfiguration="UserNameOverTransportBindingConfiguration"
    contract="OmmoOMV.Gestions.Common.Contracts.IOMVGestionService"
    name="OMVGestionServiceEndPoint" />
  
  <endpoint address="http://localhost/OMVControlesService" binding="customBinding"
    bindingConfiguration="UserNameOverTransportBindingConfiguration"
    contract="OmmoOMV.Controles.Common.Contracts.IOMVControlesService"
    name="OMVControleServiceEndPoint" />
  
  <endpoint address="http://localhost/OMVFacturationService" binding="customBinding"
    bindingConfiguration="UserNameOverTransportBindingConfiguration"
    contract="OmmoOMV.Facturation.Common.Contracts.IOMVFacturationService"
    name="OMVFacturationService" />
  
  <endpoint address="http://localhost/SecurityServices" binding="customBinding"
    bindingConfiguration="DefaultBindingConfiguration" contract="OmmoComponents.Security.Common.Contracts.ISecurityServices"
    name="SecurityServicesEndPoint" />
</client>
</system.serviceModel>

I added a new endpoint Configuration for HTTPS Windows service with a new base Adress in order to duplicate existing configuration

   <service name="EntityManagementService">
    <endpoint address="" 
              binding="customBinding" 
              bindingConfiguration="UserNameOverTransportBindingConfiguration" 
              contract="OmmoComponents.EntityManagement.Common.Contracts.IEntityManagementService" 
              name="EntityManagementServiceEndPoint" />
    <endpoint address="" 
              binding="customBinding" 
              bindingConfiguration="UserNameOverTransportBindingConfigurationExt" 
              contract="OmmoComponents.EntityManagement.Common.Contracts.IEntityManagementService" 
              name="EntityManagementServiceExtEndPoint" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:7190/EntityManagementService" />
        <add baseAddress="https://localhost:7191/EntityManagementService" />
      </baseAddresses>
    </host>
  </service>
1 Answers

Maybe we can add a http endpoint like below:

<system.serviceModel>
    <services>
      <service behaviorConfiguration="mybehavior" name="WcfService1.Service1">
        <endpoint address="" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="webbev"></endpoint>
        <endpoint address="" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="webbev" bindingConfiguration="myhttpsbinding"></endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"></endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:11010"/>
            <add baseAddress="https://localhost:11011"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="myhttpsbinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" sendTimeout="00:10:00" receiveTimeout="00:10:00">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mybehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webbev">
          <webHttp />
        </behavior>
      </endpointBehaviors>
</behaviors>

This configuration works properly over both http and https.

Related