Error posting my Webservice

Asked

Viewed 221 times

1

When I run my Webservice and publish on IIS(7) the following error occurs:

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

What can it be?

Below my web.config which is on 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>

My web.config was like this, but I haven’t been able to test it for several reasons.

<?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>

Then change, made that mistake now.

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"
  • IIS is configured with SSL only? If so, you need to use WebHttpBinding WCF to use transport security. If you want to use the WebHttpBinding without transport security (i.e., HTTP instead of HTTPS), see if HTTP is enabled in IIS.

1 answer

1


Apparently your service is registered as Https(which is through SSL) however, its Binding is set only to Http a solution to solve this problem is to define a Binding customized in your file Web.Config and define the safety mode for Transport.

You only need to use the property bindingConfiguration to point to the Binding personalized.

<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>
  • Got show, thanks. I need to really understand well configure web service.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.