i have web service in asp.net running , works fine. need access methods in web-service using ssl. works perfect when contact web-service using http:// https:// "there no endpoint listening @ https://...".
can please me on how set web.config support both http , https access web service. have tried follow guidelines can't working.
some code:
my testservice.svc:
[servicecontract(namespace = "")] [aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)] public class testservice { [operationcontract] [webget(responseformat = webmessageformat.json)] public bool validuser(string email) { return true; } }
my web.config:
<system.servicemodel> <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" /> <behaviors> <endpointbehaviors> <behavior name="serviceaspnetajaxbehavior"> <enablewebscript /> </behavior> </endpointbehaviors> <servicebehaviors> <behavior name="servicebehavior"> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> <behavior name=""> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </servicebehaviors> </behaviors> <services> <service behaviorconfiguration="servicebehavior" name="testservice"> <endpoint address="" behaviorconfiguration="serviceaspnetajaxbehavior" binding="webhttpbinding" bindingconfiguration="servicebinding" contract="testservice" /> </service> </services> <bindings> <webhttpbinding> <binding name="servicebinding" maxbufferpoolsize="1000000" maxreceivedmessagesize="1000000"> <readerquotas maxdepth="1000000" maxstringcontentlength="1000000" maxarraylength="1000000" maxbytesperread="1000000" maxnametablecharcount="1000000"/> </binding> </webhttpbinding> </bindings> </system.servicemodel>
instead of using webhttpbinding, try creating custombinding instead:
<custombinding> <binding name="poxbindinghttps" closetimeout="00:00:20"> <textmessageencoding writeencoding="utf-8" /> <httpstransport manualaddressing="true"/> </binding> <binding name="poxbindinghttp" closetimeout="00:00:20"> <textmessageencoding writeencoding="utf-8" /> <httptransport manualaddressing="true"/> </binding> </custombinding>
you'll need setup webhttpbehavior so:
<behaviors> <endpointbehaviors> <behavior name="ajaxbehavior"> <enablewebscript/> <webhttp/> </behavior> </endpointbehaviors> </behaviors>
and finally, service & endpoint:
<services> <service name="testservice"> <endpoint name="ssldefault" address="" binding="custombinding" bindingconfiguration="poxbindinghttps" behaviorconfiguration="ajaxbehavior" contract="testservice"/> <endpoint name="nossldefault" address="" binding="custombinding" bindingconfiguration="poxbindinghttp" behaviorconfiguration="ajaxbehavior" contract="testservice"/> </service> </services>
hopefully works out in creating ssl endpoint
Comments
Post a Comment