我正在尝试在 IIS 中的单独网站上托管 WCF Web 服务,并将 443 处的 https 作为唯一绑定。
当我在同时使用两种绑定 (http(80) / https(443)) 的网站中使用以下配置时,以下配置效果很好。如果我删除 http 绑定,它会开始抛出以下错误。
找不到与绑定 BasicHttpBinding 的终结点的方案 http 匹配的基地址。注册的基地址方案是 [https]。
如何使其在仅使用 https 绑定的 IIS 网站中工作?
<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>