Link to home
Start Free TrialLog in
Avatar of pclarke7
pclarke7

asked on

issues converting service from http to https

I am trying to convert my WCF service from http to https. I have purchased an SSL certificate and now I am looking at updating references to http to https. However when I do this I am getting the following warnings:

Users\Administrator\source\repos\TiosService\TiosService\App.config(141,79,-1,-1): warning : WCF configuration validation warning: The 'bindingConfiguration' attribute is invalid - The value 'webHttpsBinding_ITransaction2' is invalid according to its datatype 'serviceBindingConfigurationType'.

Below is the app.config with the changes I have made highlighted. Appreciate some guidance.
regards
Pat
 
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <!-- minimum levels Verbose, Debug, Information,Warning, Error, Fatal -->
    <add key="serilog:minimum-level" value="Information" />
    <add key="serilog:write-to:RollingFile.pathFormat" value="C:\TiosFolder\TiosServerLogs\ServerLog.txt" />
    <!--<add key="serilog:write-to:RollingFile.outputTemplate" value="customTemplate"/>
    <add key="serilog:write-to:RollingFile.fileSizeLimitBytes" value=""/>-->
    <add key="serilog:write-to:RollingFile.retainedFileCountLimit" value="32" />
    <add key="switch on global logging" value="false" />
    <add key="log details at transaction seq range." value="7,11" />
    <!-- " ", *all, seq from, seq to-->
    <add key="log details at transaction position." value="end" />
    <!-- " ","start", "end" -->
    <add key="log details for each transaction operation." value="yes" />
    <!-- " ","yes", "no" -->
    <!-- " ","Start", "End" -->
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="environment" value="test" />
    <!--<add key="boot connection string" value="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Rulesdb3;Data Source=USER-PC\RULES" />
    <add key="boot connection string" value="Provider=sqloledb;Data Source=USER-PC\RULES;Initial Catalog=Rulesdb3;User Id=pclarke1; Password=padraig" />
    <add key="boot connection string" value="Provider=sqloledb;Data Source=DEV\SQLEXPRESS;Initial Catalog=Rulesdb3;User Id=DEV\Administrator" />-->
    <add key="boot connection string" value="Provider=sqloledb;Data Source=DEV\SQLEXPRESS;Initial Catalog=Rulesdb3;User Id=pclarke1; Password=padraig" />
    <!--<add key="boot connection string type" value="oledb" /> -->
    <add key="boot connection string type" value="ole" />
    <add key="dft app connection string key msexcel_ole or oledb" value="oledb" />
    <add key="dft app connection string type" value="ole" />
    <add key="EmailProvider" value="Outlook" />
    <add key="InitialLoginPrefix" value="$6" />
    <add key="InitialLoginSuffix" value="1" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="stop at sequence number in TransactionService.cs" value="60" />
    <add key="inactivityAllowedSeconds" value="600" />
    <add key="smtp.host" value="smtp-out.edge.webcorecloud.com" />
    <add key="smtp.port" value="25" />
    <add key="smtp.credentials.username" value="info@tios.ie" />
    <add key="smtp.credentials.password" value="" />
    <!-- SOSWINSMTPIRE1, pat.clarke1@stryker.com", "spr!ng112  - OR -  smtp-out.edge.webcorecloud.com,info@tios.ie,1!eaW2z1 -->
    <add key="show_AtAGlance" value="yes" />
    <add key="show_Features" value="yes" />
    <add key="show_Stories" value="yes" />
    <add key="show_AboutVideo" value="yes" />
    <add key="show_ContactUs" value="yes" />
    <add key="show_Registration" value="yes" />
    <add key="show_DemoOption" value="yes" />
    <add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" />
  </appSettings>
  <!-- Trace Log for Service -->
  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel" switchValue="All" propagateActivity="true">
        <listeners>
          <add name="tiostrace" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\TiosFolder\TiosTraceLogs\log.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
  <system.serviceModel>
    <diagnostics>
      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000" maxSizeOfMessageToLog="2000" />
    </diagnostics>
  </system.serviceModel>
  <system.web>
    <trust level="Full" />
    <globalization culture="en-IE" />
    <sessionState timeout="30">
    </sessionState>
    <customErrors mode="Off" />
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" defaultUrl="~/Default.aspx" protection="All" timeout="30" />
    </authentication>
    <!-- deny all non logged in users ...-->
    <authorization>
      <!-- TEMP REMOVAL <deny users="?" /> -->
      <allow users="*" />
    </authorization>
    <!-- Required to prevent error when updating Service reference -->
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.ApplicationInsightsHttpModule, Microsoft.ApplicationInsights.Extensibility.Web" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>
    <httpRuntime maxRequestLength="2147483647" />
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
    </compilation>
    <roleManager enabled="true" defaultProvider="ClientRoleProvider">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" connectionStringName="DefaultConnection" />
      </providers>
    </roleManager>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" connectionStringName="DefaultConnection" credentialsProvider="" />
      </providers>
    </membership>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <staticContent>
      <remove fileExtension=".label" />
      <mimeMap fileExtension=".label" mimeType="application/DYMO Label Software" />
    </staticContent>
  </system.webServer>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="web" helpEnabled="true" automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat="Json" />
      </webHttpEndpoint>
    </standardEndpoints>
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="TiosService.TransactionService" behaviorConfiguration="servicebehavior">
        <host>
          <baseAddresses>
            <!--<add baseAddress="[b]https[/b]://localhost:8733/Design_Time_Addresses/TiosService/PassedParms/" />-->
            <add baseAddress="[b]https[b/]://localhost:8733/Design_Time_Addresses/TiosService/TransactionService/soap" />
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint name="RESTendpoint" address="web" binding="web[b]Https[b/]Binding" bindingConfiguration="web[b]Https[b/]Binding_ITransaction2" behaviorConfiguration="webBehavior" contract="TiosService.ITransaction2">
        </endpoint>
        <endpoint name="SOAPendpoint" address="soap" binding="ws[b]Https[b/]Binding" bindingConfiguration="ws[b]Https[b/]Binding_ITransaction" contract="TiosService.ITransaction">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mex[b]Https[b/]Binding" bindingConfiguration="mex[b]Https[b/]Binding_ITransaction" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="servicebehavior">
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
      <!-- New -->
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <!-- end new -->
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="ws[b]Https[b/]Bindings_ITransaction" maxReceivedMessageSize="2147483647" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" closeTimeout="00:30:00" maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession enabled="true" />
          <security mode="None" />
          <!--<security mode="Transport" >
          <transport clientCredentialType="None"/>
          </security>-->
        </binding>
      </wsHttpBinding>
      <mexHttpBinding>
        <binding name="mex[b]Https[b/]Binding_ITransaction" />
      </mexHttpBinding>
      <webHttpBinding>
        <binding name="web[b]Https[b/]Binding_ITransaction2" />
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <publisherPolicy apply="no" />
        <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="4.121.0.0 - 4.65535.65535.65535" newVersion="4.122.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.AI.Agent.Intercept" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.ManagedDataAccess.Client" />
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
  </system.data>
  <oracle.manageddataaccess.client>
    <version number="*">
      <dataSources>
        <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
      </dataSources>
    </version>
  </oracle.manageddataaccess.client>
  <connectionStrings>
    <clear />
    <add name="OraAspNetConString" connectionString=" " />
    <add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
  </connectionStrings>
</configuration>

Open in new window

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

1) In the Solution Explorer, under the Service References folder, right-click the service reference name with the issue and select 'Configure Service Reference'.

2) The Service Reference Settings window will appear. Uncheck the box labeled 'Reuse types in referenced assemblies' and click the OK button.

3) Rebuild the project.

After rebuilding, retest

https://stackoverflow.com/questions/15497378/the-value-is-invalid-according-to-its-datatype-clientcontracttype
hi.. Kindly add following rule into your web.config file.

<rewrite>
            <rules>
 
<rule name="Force HTTPS" enabled="true">    
   <match url="(.*)" ignoreCase="false"/>    
   <conditions>    
      <add input="{HTTPS}" pattern="off"/>    
   </conditions>    
   <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true"
 
redirectType="Permanent"/>    
      </rule>    
</rules>
        </rewrite>
Hello, can you please try the following steps

Change mexHttpBinding to mexHttpsBinding in the second end point.

Hide   Copy Code
<service name="WCFWSHttps.Service1" behaviorConfiguration="WCFWSHttps.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="https://localhost/WCFWSHttps/Service1.svc" binding="wsHttpBinding"

   bindingConfiguration="TransportSecurity" contract="WCFWSHttps.IService1"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.