本文介绍了WCF异常:无法找到端点匹配计划http的基址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在443的唯一绑定在IIS中一个单独的网站以https举办一个WCF Web服务。



下面的配置效果很好,当我在同时使用绑定一个网站,使用它(HTTP(80)/ HTTPS(443))。如果我删除HTTP绑定,它开始抛出下面的错误。



找不到匹配计划http端点与绑定的基址basicHttpBinding的。已注册的基址方案是[HTTPS]。



我如何让它在一个IIS网站的工作,仅HTTPS绑定?

 < system.serviceModel> 
<&绑定GT;
<&basicHttpBinding的GT;
<绑定名称=defaultBasicHttpBinding>
<安全模式=运输>
<运输clientCredentialType =无proxyCredentialType =无的境界=/>
<消息clientCredentialType =证书algorithmSuite =默认/>
< /安全>
< /&结合GT;
< / basicHttpBinding的>
< /绑定>
<客户端>
<端点地址=HTTP://localhost/ERPService/retailPayment.svc
结合=basicHttpBinding的bindingConfiguration =defaultBasicHttpBinding
合同=RetailPaymentService.RetailPayment.SVRetailPaymentService的名字=EnterpriseRetailPayment/>
< /客户>
<&行为GT;
< serviceBehaviors>
<行为NAME =MyServiceTypeBehaviors>
< serviceMetadata httpGetEnabled =真/>
< serviceDebug includeExceptionDetailInFaults =真/>
< /行为>
<&行为GT;
< serviceMetadata httpGetEnabled =真/>
< serviceDebug includeExceptionDetailInFaults =真/>
< /行为>
< / serviceBehaviors>
< endpointBehaviors>
<行为NAME =MyEndPointBehavior>
<! - < SchemaValidator启用=真/> - >
< /行为>
< / endpointBehaviors>
< /行为>
<服务和GT;
<服务名称=SettlementSalesCollection.SaleItemServicebehaviorConfiguration =MyServiceTypeBehaviors>
<端点behaviorConfiguration =MyEndPointBehavior绑定=basicHttpBinding的
NAME =SettlementSalesCollection
合同=SettlementSalesCollection.CITransactionSettlementListenerService/>
<端点名称=mexEndpoint合同=IMetadataExchange接口绑定=mexHttpBinding地址=MEX/>
< /服务>
< /服务>
<附加功能,GT;
< behaviorExtensions>
<添加名称=SchemaValidator
型=SettlementSalesCollection.SchemaValidation.SchemaValidationBehavior + CustomBehaviorSection,SettlementSalesCollectionService,版本= 1.0.0.0,文化=中性/>
< / behaviorExtensions>
< /扩展>
< protocolMapping>
<添加绑定=basicHttpsBinding计划=HTTPS/>
< / protocolMapping>
< serviceHostingEnvironment aspNetCompatibilityEnabled =真multipleSiteBindingsEnabled =真/>
< /system.serviceModel>


解决方案

您配置应该类似。您可能需要修改<运输clientCredentialType =无proxyCredentialType =无/> 根据自己的需要进行身份验证。该配置如下不需要任何身份验证

 <&绑定GT; 
<&basicHttpBinding的GT;
<绑定名称=basicHttpBindingConfiguration>
<安全模式=运输>
<运输clientCredentialType =无proxyCredentialType =无/>
< /安全>
< /&结合GT;
< / basicHttpBinding的>
< /绑定>

<服务和GT;
<服务名称=XXX>
<终点
NAME =AAA
地址=
结合=basicHttpBinding的
bindingConfiguration =basicHttpBindingConfiguration
合同=YourContract />
< /服务>
<服务和GT;

这将使具有 basicHttpBinding的 WCF服务使用HTTPS。


I'm trying to host a WCF web service on a separate Website in IIS with https at 443 as the only binding.

The following configurations works well when I use it in a website which uses both the bindings (http(80) / https(443)). If I remove the http binding, it starts throwing the following error.

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

How do I make it work in an IIS website with https binding only?

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="defaultBasicHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/ERPService/retailPayment.svc"
                binding="basicHttpBinding" bindingConfiguration="defaultBasicHttpBinding"
                contract="RetailPaymentService.RetailPayment.SVRetailPaymentService" name="EnterpriseRetailPayment" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="MyEndPointBehavior">
          <!--<SchemaValidator enabled="true"/>-->
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="SettlementSalesCollection.SaleItemService" behaviorConfiguration="MyServiceTypeBehaviors">
        <endpoint behaviorConfiguration="MyEndPointBehavior" binding="basicHttpBinding"
                  name="SettlementSalesCollection"
                  contract="SettlementSalesCollection.CITransactionSettlementListenerService" />
        <endpoint name="mexEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
    <extensions>
      <behaviorExtensions>
        <add name="SchemaValidator"
             type="SettlementSalesCollection.SchemaValidation.SchemaValidationBehavior+CustomBehaviorSection, SettlementSalesCollectionService, Version=1.0.0.0, Culture=neutral" />
      </behaviorExtensions>
    </extensions>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
解决方案

Your configuration should look similar to that. You may have to change <transport clientCredentialType="None" proxyCredentialType="None" /> depending on your needs for authentication. The config below doesn't require any authentication.

<bindings>
    <basicHttpBinding>
        <binding name="basicHttpBindingConfiguration">
            <security mode="Transport">
                <transport clientCredentialType="None" proxyCredentialType="None" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>

<services>
    <service name="XXX">
        <endpoint
            name="AAA"
            address=""
            binding="basicHttpBinding"
            bindingConfiguration="basicHttpBindingConfiguration"
            contract="YourContract" />
    </service>
<services>

That will allow a WCF service with basicHttpBinding to use HTTPS.

这篇关于WCF异常:无法找到端点匹配计划http的基址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 06:16