I'm exposing a web service to my client side javascript using .Net's Scriptmanager as follows:
<asp:ScriptManager ID="scriptMgr" runat="server">
<services>
<asp:servicereference Path="RmUiControlDataSVC.svc" />
</services>
</asp:ScriptManager>
In my javascript I can call it like this:
var service = new RmUiControlDataSVC();
When I run this from my local server, it works fine and I can run the methods within. It also runs when I deploy remotely and connect to my site using http:
.(working on my site http://myserver/msftqa/RmMain.aspx) However, the problem comes in when I attempt to connect to the same application using https:
(https://mysite.com/msftqa/RmMain.aspx). Now when I attempt to access the methods of the service, I get a
503 Service Unavailable
Inspecting through Firebug reveals that my Svc is attempting to bind using http:
instead of https:
and is this not able to find the service. Here is the relevent section of the web.config
<service name="Company.App.RM.RmUiControlDataSVC">
<endpoint address="" behaviorConfiguration="Company.App.RM.RmUiControlDataAspNetAjaxBehavior"
binding="webHttpBinding" contract="Company.App.RM.RmUiControlDataSVC" />
</service>
Is there a way that I can tell the service to use https:
when connected through https but still have it work when I connect using http:
?