I have been fighting with configuring a WCF service hosted in a silverlight 4 application work over both https and http. so far i have only managed to get it work over either http or https but not both. I need it to be called on both.
Below is my full system.serviceModel section in the web.config file.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<bindings>
<customBinding>
<binding name="TestApp.Data.customBinding0">
<binaryMessageEncoding/>
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
<binding name="TestApp.Data.customBinding0.https">
<binaryMessageEncoding/>
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
<services>
<service name="TestApp.Data" behaviorConfiguration="TestApp.Data">
<endpoint address="" binding="customBinding" bindingConfiguration="TestApp.Data.customBinding0" contract="TestApp.Data"/>
<endpoint address="mex" binding="mexHttpBinding" name="" contract="IMetadataExchange"/>
<endpoint address="" binding="customBinding" bindingConfiguration="TestApp.Data.customBinding0.https" contract="TestApp.Data"/>
<endpoint address="mexhttp" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TestApp.Data" >
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
And below is my full ServiceReferences.ClientConfig
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<!--http-->
<binding name="CustomBinding_Data_http">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
<!--https-->
<binding name="CustomBinding_Data">
<binaryMessageEncoding />
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="//localhost/TestApp/Webservice/Data.svc" binding="customBinding" bindingConfiguration="CustomBinding_Data_http" contract="GetData.Data" name="CustomBinding_Data_http" />
<endpoint address="//localhost/TestApp/Webservice/Data.svc" binding="customBinding" bindingConfiguration="CustomBinding_Data" contract="GetData.GetData" name="CustomBinding_Data" />
</client>
With the above configurations, i'm only able to call it over https, but i also need to be able to call it over http.
When i try to call it over http, i get below error message
The provided URI scheme 'http' is invalid; expected 'https'. Parameter name: via
What change i'm i supposed to make to those configurations to get this WCF thing work over both https & http.