簡體   English   中英

在IIS中發布Web服務時出錯-找不到基礎…綁定WebHttpBinding。 注冊的基址方案為[https]

[英]Error publishing web service in IIS - Could not find a base… binding WebHttpBinding. Registered base address schemes are [https]

我正在嘗試發布在VS2015中創建和發布的Web服務。 當我在IIS中發布它時,出現以下錯誤: 找不到與綁定WebHttpBinding的端點的方案http匹配的基地址。 注冊的基址方案是[https],我看到了很多關於它的文章,並且我嘗試更改IIS和web.config都沒有成功。

我已經在IIS中使用自簽名證書配置了https網站。 它正常工作,但是當我嘗試訪問Web服務時,出現了上面描述的錯誤。 如果我在http網站中使用此web服務,則可以正常使用。

我的web.config

    <?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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation targetFramework="4.6" />
    <httpRuntime targetFramework="4.6" />
    <customErrors mode="Off"/>  
  </system.web>
  <system.serviceModel>
    <!--CONFIGURAÇÃO DO SERVIÇO-->
    <services>      
      <service name="ServicoRest.ServiceGestorWMS">
        <endpoint address="../ServiceGestorWMS.svc" binding="webHttpBinding" contract="ServicoRest.IServiceGestorWMS" behaviorConfiguration="webBehaviour" />
        <endpoint address="mex"  
                  binding="mexHttpsBinding"  
                  contract="IMetadataExchange" />  
      </service>
    </services>
     <bindings>
   <webHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
    <binding name="webHttpsBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="Transport">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </webHttpBinding>
 </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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>
      <!--CONFIGURAÇÃO DO SERVIÇO-->
      <endpointBehaviors>
        <behavior name="webBehaviour">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <!--SE VOCÊ PRECISAR ACESSAR O SERVIÇO DE OUTRO DOMÍNIO VIA JAVASCRIPT VOCÊ DEVE INFORMAR O BLOCO DE CÓDIGO ABAIXO -->
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type, Accept" />
        <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
      </customHeaders>
    </httpProtocol>
    <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>
  <connectionStrings>
    <add name="" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=;initial catalog=;persist security info=True;user id=sa;password=;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>
<!--ProjectGuid: {D84BF523-87CA-4D7D-90AE-CEE789984582}-->

墨菲

您似乎尚未設置綁定。 如果要為webHttpBinding支持HTTP和HTTPS,則需要在web.config中使用以下代碼:

<webHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
    <binding name="webHttpsBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="Transport">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </webHttpBinding>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM