31483

How to Configuring WCF services to work with both HTTP and HTTPS - multiple bindings not working

Question:

Iam fairly new to Silver-light and WCF, so please bear with me.

I have silver-light application that calls .svc service. The service is being called successfully over https but i would also like to make it work with calls over plain http.

What modifications do i need to make to my web.config and ServiceReferences.ClientConfig files below.

<strong>My complete system.serviceModel section in my Web.config file is this.</strong>

<system.serviceModel> <bindings> <customBinding> <binding name="MyApp.Web.GetData.customBinding" receiveTimeout="00:30:00" sendTimeout="00:30:00" > <binaryMessageEncoding/> <httpsTransport/> </binding> </customBinding> </bindings> <services> <service name="MyApp.Web.GetData"> <endpoint address="" binding="customBinding" bindingConfiguration="MyApp.Web.GetData.customBinding" contract="MyApp.Web.GetData" /> <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MyApp.Web.GetData"> <serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> <dataContractSerializer maxItemsInObjectGraph="2147483646"/> </behavior> <behavior name=""> <serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel>

<strong>And my complete ServiceReferences.ClientConfig file is below</strong>

<configuration> <system.serviceModel> <bindings> <customBinding> <binding name="CustomBinding_GetData"> <binaryMessageEncoding /> <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> </customBinding> </bindings> <client> <endpoint address="//localhost/MyApp.Web/Webservice/GetData.svc" binding="customBinding" bindingConfiguration="CustomBinding_GetData" contract="GetData.GetData" name="CustomBinding_GetData" /> </client> </system.serviceModel>

Answer1:

Try to add another endpoint and another binding with no ssl:

</customBinding> </bindings> <client> <endpoint address="//localhost/MyApp.Web/Webservice/GetData.svc" binding="customBinding" bindingConfiguration="CustomBinding_GetData-ssl" contract="GetData.GetData" name="CustomBinding_GetData-ssl" /> <endpoint address="//localhost/MyApp.Web/Webservice/GetData.svc" binding="customBinding" bindingConfiguration="CustomBinding_GetData" contract="GetData.GetData" name="CustomBinding_GetData" /> </client> </system.serviceModel>

Recommend

  • Jersey HTTP response 200 OK but returning content wrong (username/password incorrect)
  • Error on creating Rest client using jersey
  • is putting sqs-consumer to detect receiveMessage event in sqs scalable
  • How to draw 2 google charts on same html
  • How to catch exception/fault where message size is larger than accepted by the service (server side)
  • c# wcf hosted in windows service goes idle after 5 minutes
  • MSMQ, Message is put on queue and disapears but is never picked up by service contract
  • Can't get WCF service's operations list with Web Service Studio client
  • CMake finds the correct library, but VC++ attempts to link with something else
  • add service reference xamarin PCL
  • Calling a secure webservice in SSIS through script task
  • How to get value from merged-cells in Excel document using OpenXML and C#
  • change search magnifying glass to UIActivityIndicatorView
  • jQuery - resize an elements height to match window without refreshing, on window resize
  • Magento get URL before current
  • Aptana 3 remove bundle (jquery)
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • Prevent Tomcat from caching request during starup
  • Uncaught TypeError: $(…).select2 is not a function
  • How do I signal completion of my dataflow?
  • How to use JavaScript to determine whether a file exists in a directory?
  • Nant, Vault & Windows Integrated Authentication
  • HTML download movie download link
  • swift auto completion not working in Xcode6-Beta
  • Does CUDA 5 support STL or THRUST inside the device code?
  • SSO with signing and signature validation doesn't work
  • Validaiting emails with Net.Mail MailAddress
  • htaccess rewriting URLs with multiple forward slashes
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • SVN: Merging two branches together
  • Circular dependency while pushing http interceptor
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Proper folder structure for lots of source files
  • How does Linux kernel interrupt the application?
  • Busy indicator not showing up in wpf window [duplicate]
  • UserPrincipal.Current returns apppool on IIS