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>
This question is related to
c#
wcf
web-services
My issue was caused by missing bindings in IIS, in the left tree view "Connections", under Sites, Right click on your site > edit bindings > add > https
Choose 'IIS Express Development Certificate' and set port to 443 Then I added another binding to the webconfig:
<endpoint address="wsHttps" binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding" name="Your.bindingname" contract="Your.contract" />
Also added to serviceBehaviours:
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
And eventually it worked, none of the solutions I checked on stackoverflow for this error was applicable to my specific scenario, so including here in case it helps others
In my case the binding name in under protocol mapping did not match the binding name on the endpoint. They match in the example below.
<endpoint address="" binding="basicHttpsBinding" contract="serviceName" />
and
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
Open IIS And right click on Default App Pool and Add Binding to make application work with HTTPS protocol.
type : https
IP address : All unassigned
port no : 443
SSL Certificate : WMSVC
then
Click on and restart IIS
Done
In my case this fixed the issue
You can get this if you ONLY configure https
as a site binding inside IIS.
You need to add http(80)
as well as https(443)
- at least I did :-)
My issue was also caused by missing https binding in IIS: Selected default website > On the far right pane selected Bindings > add > https
Choose 'IIS Express Development Certificate' and set port to 443
I tried the binding according to the answer by @Szymon but It did not work for me. I tried basicHttpsBinding which is new in .net 4.5 and It solved the issue. Here is the complete configuration that works for me.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpsBinding>
<binding name="basicHttpsBindingForYourService">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"/>
</security>
</binding>
</basicHttpsBinding>
</bindings>
<services>
<service name="YourServiceName">
<endpoint address="" binding="basicHttpsBinding" bindingName="basicHttpsBindingForYourService" contract="YourContract" />
</service>
</services>
</system.serviceModel>
FYI: My application's target framework is 4.5.1. IIS web site that I created to deploy this wcf service only has https binding enabled.
Source: Stackoverflow.com