.net - How to configure a single WCF Service to have multiple HTTP and HTTPS endpoints? -


what trying single wcf service work in development environment http scheme, and, also, have same service work in production environment https scheme. if remove 2 https endpoints (those suffixed 'https'), works in development enviornment; likewise, if remove 2 http endpoints works in production environment. have 4 endpoints in web.config, if possible.

my endpoints defined below:

<endpoint address="/web"          behaviorconfiguration="ajaxbehavior"         binding="wshttpbinding"          bindingconfiguration="web"          name="web"         contract="service" /> <endpoint address="/custom"         binding="custombinding"          bindingconfiguration="custom"          name="custom"            contract="service" /> <endpoint          address="/webhttps"          behaviorconfiguration="ajaxbehavior"         binding="wshttpbinding"          bindingconfiguration="webhttps"          name="webhttps"         contract="service" /> <endpoint address="/customhttps"         binding="custombinding"          bindingconfiguration="customhttps"          name="customhttps"          contract="service" /> 

edited: editing question add error getting, , binding sections (below). sorry new length of question.

the error is: "could not find base address matches scheme http endpoint binding webhttpbinding. registered base address schemes [https]."

additionally, production site set "require ssl". can not change.

the bindings configurations are:

<behaviors>   <servicebehaviors>     <behavior name="servicebehavior">       <servicemetadata httpgetenabled="true" httpsgetenabled="true"  />       <servicedebug includeexceptiondetailinfaults="true" />     </behavior>   </servicebehaviors>   <endpointbehaviors>     <behavior name="ajaxbehavior">       <enablewebscript/>     </behavior>   </endpointbehaviors> </behaviors>  <bindings>   <custombinding>     <binding name="custom">       <textmessageencoding>         <readerquotas maxdepth="7000000" maxstringcontentlength="7000000"             maxarraylength="7000000" maxbytesperread="7000000"             maxnametablecharcount="7000000" />       </textmessageencoding>        <httptransport maxbufferpoolsize="7000000" maxreceivedmessagesize="7000000"           maxbuffersize="7000000" />     </binding>     <binding name="customhttps">       <textmessageencoding>         <readerquotas maxdepth="7000000" maxstringcontentlength="7000000"             maxarraylength="7000000" maxbytesperread="7000000"                   maxnametablecharcount="7000000" />       </textmessageencoding>        <httpstransport maxbufferpoolsize="7000000" maxreceivedmessagesize="7000000"           maxbuffersize="7000000" />      </binding>   </custombinding>    <webhttpbinding>     <binding name="web"  maxbufferpoolsize="70000000"         maxreceivedmessagesize="70000000">       <readerquotas maxdepth="70000000" maxstringcontentlength="70000000"           maxarraylength="70000000" maxbytesperread="70000000"           maxnametablecharcount="70000000" />       <security mode="none" />     </binding>      <binding name="webhttps" maxbufferpoolsize="70000000"         maxreceivedmessagesize="70000000">        <readerquotas maxdepth="70000000" maxstringcontentlength="70000000"                 maxarraylength="70000000" maxbytesperread="70000000"                 maxnametablecharcount="70000000" />        <security mode="transport" />     </binding>   </webhttpbinding> </bindings> <servicehostingenvironment aspnetcompatibilityenabled="true" /> 

any ideas?

follow these steps-

1) write 2 endpoints service, 1 http , https.

<services>     <service behaviorconfiguration="myservicebehavior" name="jk.myservice">        <endpoint address="" behaviorconfiguration="webbehavior" binding="webhttpbinding" bindingconfiguration="webbinding" contract="jk.imyservice">         <identity>           <dns value="localhost" />         </identity>       </endpoint>        <endpoint address="" behaviorconfiguration="webbehavior" binding="webhttpbinding" bindingconfiguration="webbindinghttps" contract="jk.imyservice">         <identity>           <dns value="localhost" />         </identity>       </endpoint>           </service>   </services> 

2) enable both httpgetenabled="true" httpsgetenabled="true" in servicebehaviors.

<behaviors>  <servicebehaviors>         <behavior name="myservicebehavior">     <servicemetadata httpgetenabled="true" httpsgetenabled="true"/>     <servicedebug includeexceptiondetailinfaults="true" />   </behavior>       </servicebehaviors>  <endpointbehaviors>   <behavior name="webbehavior">     <webhttp/>   </behavior> </endpointbehaviors>  </behaviors> 

3) write 2 bindings configurations http , https. http give security mode="none" , https give mode="transport".

<bindings>     <webhttpbinding>        <binding name="webbinding">         <security mode="none">           <transport clientcredentialtype="none" />         </security>       </binding>        <binding name="webbindinghttps">         <security mode="transport">           <transport clientcredentialtype="none" />         </security>       </binding>      </webhttpbinding>   </bindings> 

check link


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -