kls dngr

kls dngr

  • NA
  • 17
  • 5.3k

Allow web service to serve both request http and https?

Feb 22 2016 8:21 AM
  1. <system.serviceModel>  
  2. <services>  
  3. <service behaviorConfiguration="Complete_Html5.CompleteService.CompleteServiceAspNetAjaxBehavior" name="Complete_Html5.CompleteService.Complete">  
  4. <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Complete" contract="Complete_Html5.CompleteService.Complete" />  
  5. <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />  
  6. </service>  
  7. <service name="Complete_Html5.Service1" behaviorConfiguration="Complete_Html5.Service1ServiceAspNetAjaxBehavior">  
  8. <endpoint address="" binding="basicHttpBinding" contract="Complete_Html5.Service1" />  
  9. <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />  
  10. </service>  
  11. </services>  
  12. <behaviors>  
  13. <endpointBehaviors>  
  14. <behavior name="Complete_Html5.Service1AspNetAjaxBehavior">  
  15. <enableWebScript />  
  16. </behavior>  
  17. <behavior name="Complete_Html5.CompleteService.CompleteServiceAspNetAjaxBehavior">  
  18. <enableWebScript />  
  19. </behavior>  
  20. </endpointBehaviors>  
  21. <serviceBehaviors>  
  22. <behavior name="Complete_Html5.CompleteService.CompleteServiceAspNetAjaxBehavior">  
  23. <serviceMetadata httpGetEnabled="true" />  
  24. <serviceDebug includeExceptionDetailInFaults="true" />  
  25. </behavior>  
  26. <behavior name="Complete_Html5.Service1ServiceAspNetAjaxBehavior">  
  27. <serviceMetadata httpGetEnabled="true" />  
  28. <serviceDebug includeExceptionDetailInFaults="true" />  
  29. </behavior>  
  30. </serviceBehaviors>  
  31. </behaviors>  
  32. <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />  
  33. <bindings>  
  34. <basicHttpBinding>  
  35. <binding name="BasicHttpBinding_Complete" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="10485760" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">  
  36. <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />  
  37. <security mode="None">  
  38. <transport clientCredentialType="None" proxyCredentialType="None" realm="" />  
  39. <message clientCredentialType="UserName" algorithmSuite="Default" />  
  40. </security>  
  41. </binding>  
  42. <binding name="BasicHttpBinding_Complete1" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">  
  43. <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />  
  44. <security mode="None">  
  45. <transport clientCredentialType="None" proxyCredentialType="None" realm="" />  
  46. <message clientCredentialType="UserName" algorithmSuite="Default" />  
  47. </security>  
  48. </binding>  
  49. <binding name="BasicHttpBinding_Service1" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="10485760" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">  
  50. <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />  
  51. <security mode="None">  
  52. <transport clientCredentialType="None" proxyCredentialType="None" realm="" />  
  53. <message clientCredentialType="UserName" algorithmSuite="Default" />  
  54. </security>  
  55. </binding>  
  56. <binding name="BasicHttpBinding_Service11" />  
  57. </basicHttpBinding>  
  58. </bindings>  
  59. <client>  
  60. <endpoint address="http://www.examplete.com:83/CompleteService/Complete.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Complete" contract="Complete_Html5.CompleteService.Complete" name="BasicHttpBinding_Complete" />  
  61. <endpoint address="http://www.examplete.com:83/CompleteService/Complete.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Complete1" contract="PMCService.Complete" name="BasicHttpBinding_Complete1" />  
  62. <endpoint address="http://www.examplete.com:83/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service1" contract="ReportService.Service1" name="BasicHttpBinding_Service1" />  
  63. <endpoint address="http://www.examplete.com:83/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service11" contract="ReportService.Service1" name="BasicHttpBinding_Service11" />  
  64. </client>  
  65. </system.serviceModel>  
Above is the `service` setting in `web.config` what changes I have to make so that I could use both hits `http` and `https` while accessing `website`??
We have added ssl certificate to server and have unchecked `required ssl` from website `ssl` certificate setting.
 
It it working fine `http` but when hits come is website is with `https` it's throwing error as:
> The provided URI scheme `https` is invalid; Expected `http`. Parameter
> name: via.
How to solve this so that allow both hits `http` and `https`?
> This is specially when we calling web service method.!
Have tried by adding `httpsGetEnabled="true"` in serviceMetadata element but still not working..!

Answers (1)