के साथ WebHttp बाइंडिंग मैं वेबसाइट के लिए https & http का उपयोग करने की कोशिश कर रहा हूं। वेबसाइट में .svc फ़ाइलें हैं जो आरईएसटी सेवा के रूप में कार्य करती हैं और जावास्क्रिप्ट से बुलाती हैं।एचटीपी और एचटीपीएस
मेरे कॉन्फ़िग:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AjaxBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="MyServiceBehaviour" name="MyService.Lookups">
<endpoint address="" behaviorConfiguration="AjaxBehavior"
binding="webHttpBinding" bindingConfiguration="httpWebBinding" contract="MyService.Lookups" >
</endpoint>
<endpoint address="" behaviorConfiguration="AjaxBehavior"
binding="webHttpBinding" bindingConfiguration="httpsWebBinding" contract="MyService.Lookups" >
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="httpsWebBinding">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
<binding name="httpWebBinding">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
ब्राउज़िंग https://myserver/services/Lookups.svc/Hello देता
एक आधार पता है कि बाध्यकारी WebHttpBinding साथ अंत बिंदु के लिए योजना http मेल खाता नहीं मिल सका। पंजीकृत आधार पते योजनाओं [https]
ब्राउज़िंग http://myserver/services/Lookups.svc/Hello देता हैं
एक आधार पता है कि बाध्यकारी WebHttpBinding साथ अंत बिंदु के लिए योजना https से मेल खाता नहीं मिल सका। पंजीकृत आधार पता योजनाएं हैं [http]
यदि मैं किसी भी एक एंडपॉइंट को हटा देता हूं तो यह काम करता है। उदाहरण bindingConfiguration="httpWebBinding"
के साथ कॉन्फ़िगर किए गए एंडपॉइंट को हटाकर HTTPS,
मैं इसे HTTP और HTTPS के साथ कैसे काम कर सकता हूं? अभी तक, मैं एक एंडपॉइंट को हटाकर या तो http या https का उपयोग करने में सक्षम हूं।
भेजा How can I combine the WCF services config for both http and https in one web.config? और How do you setup HTTP and HTTPS WCF 4 RESTful services?
नोट: आईआईएस में, यह दो वेब साइटों एक https पर http और एक अन्य पर सुनने है। दोनों भौतिक फ़ोल्डर में
अद्यतन एक ही कोड साझा करने: अब के रूप में, मैं अंतिम बिंदुओं को हटा दिया है और यह काम करता है। लेकिन मेरी चिंता व्यवहार के साथ कॉन्फ़िगर किए गए एंडपोइंग को हटा रहा है कॉन्फ़िगरेशन मेरे लिए बहुत अच्छा समाधान नहीं दिखता है।
यह दोनों http & https
<services>
<service behaviorConfiguration="MyServiceBehaviour" name="MyService.Lookups">
</service>
</services>
'httpsGetEnabled =" true "के साथ' https' url होना चाहिए, लेकिन आपने किसी को परिभाषित नहीं किया है। –