sexta-feira, 27 de dezembro de 2013

Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http]

Link to get the project example: click here

I was having a problem to configure a WCF with wsHttpBinding, and after a big research I found a solution. Here the web.config:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WCFServiceAuthentication.ServiceAuthentication" behaviorConfiguration="ServiceBehavior">
        <!-- Service Endpoints -->
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="WCFServiceAuthentication.IServiceAuthentication">
          <!--<identity>
            <dns value="localhost" />
          </identity>-->
        </endpoint>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Basic" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpsGetEnabled="true" httpsGetUrl="" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="false"/>
  </system.webServer>

</configuration>

Just paste this code into your web.config that gonna work.

Thank you and see you on the next POST.

Credits: MSDN Forum

Nenhum comentário:

Postar um comentário