1

Quando eu executo o meu WebService e publico no IIS(7) ocorre o seguinte erro:

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

O que pode ser?

Abaixo o meu web.config que está no IIS.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation defaultLanguage="c#" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>

  <connectionStrings>
  </connectionStrings>

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="SuporteTecnicoWS.SuporteTecnicoServiceWS">
        <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" contract="SuporteTecnicoWS.ISuporteTecnicoServiceWS" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <!-- 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="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp automaticFormatSelectionEnabled="true" defaultOutgoingResponseFormat="Xml" />
          <!--<webHttp/>-->
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </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="true" />
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Ficou assim meu web.config, mas ainda não pude testar por várias razões.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation defaultLanguage="c#" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <connectionStrings>
    <add name="V99_QAEntities" connectionString="metadata=res://*/Models.V99.csdl|res://*/Models.V99.ssdl|res://*/Models.V99.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=54.187.114.104;initial catalog=V99;persist security info=True;user id=V99App;password=V99@1032ab;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="V99_WEB_QAEntities" connectionString="metadata=res://*/Models.V99_Web.csdl|res://*/Models.V99_Web.ssdl|res://*/Models.V99_Web.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=54.187.114.104;initial catalog=V99_WEB;persist security info=True;user id=V99App;password=V99@1032ab;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="V99_OLAP_QAEntities" connectionString="metadata=res://*/Models.V99_Olap.csdl|res://*/Models.V99_Olap.ssdl|res://*/Models.V99_Olap.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=54.187.114.104;initial catalog=V99_OLAP;persist security info=True;user id=V99App;password=V99@1032ab;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="SuporteTecnicoWS.SuporteTecnicoServiceWS">
        <endpoint 
            address="" behaviorConfiguration="web" 
            binding="webHttpBinding"
            bindingConfiguration="webHttpsBinding"
            contract="SuporteTecnicoWS.ISuporteTecnicoServiceWS" />
      </service>
    </services>

      <bindings>
          <webHttpBinding>
              <binding name="webBinding">
                  <security mode="Transport">
                  </security>
              </binding>
          </webHttpBinding>
      </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <!-- 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="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp automaticFormatSelectionEnabled="true" defaultOutgoingResponseFormat="Xml" />
          <!--<webHttp/>-->
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </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="true" />
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Depois dfa alteração, deu esse erro agora.

Parser Error Message: The binding at system.serviceModel/bindings/webHttpBinding does not have a configured binding named 'webHttpsBinding'. This is an invalid value for bindingConfiguration.

Source Error: 


Line 20:      <services>
Line 21:          <service behaviorConfiguration="ServiceBehaviour" name="SuporteTecnicoWS.SuporteTecnicoServiceWS">
Line 22:              <endpoint
Line 23:                  address="" behaviorConfiguration="web"
Line 24:                  binding="webHttpBinding"
1
  • O IIS está configurado com SSL apenas? Se for o caso, você precisa usar o WebHttpBinding do WCF para usar transport security. Se você quiser usar o WebHttpBinding sem segurança de transporte (i.e., HTTP em vez de HTTPS), veja se HTTP está habilitado no IIS. Commented 22/05/2014 às 20:03

1 Resposta 1

1

Aparentemente o seu serviço está registrado como Https(que é através do SSL) porém, o seu Binding está configurado apenas para Http uma solução para resolver esse problema é definir um Binding personalizado no seu arquivo Web.Config e definir o modo de segurança para Transport.

Você só precisa utilizar a propriedade bindingConfiguration para apontar para o binding personalizado.

<services> ...
        <endpoint
            address=""
            binding="webHttpBinding"
            behaviorConfiguration="webHttpEndpointBehavior"
            bindingConfiguration="webBinding"
            contract="SuporteTecnicoWS.ISuporteTecnicoServiceWS" />
        </endpoint>
...
</services>

<bindings> ...
   <webHttpBinding>
     <binding name="webBinding">
       <security mode="Transport">
       </security>
     </binding>
   </webHttpBinding>
 ...
 </bindings>
1
  • Ficou show, valeu. Preciso realmente entender bem configurar web service.
    – pnet
    Commented 22/05/2014 às 23:21

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .