如果 HTTP 工作正常,我是否需要执行任何特殊操作才能使 WCF 调用通过 HTTPS 工作?

发布于 2024-09-15 12:41:06 字数 1277 浏览 3 评论 0原文

我有同一个概念验证网站的两个版本: 不安全版本:

http:// www.tlsadmin.com/tlsadmin/PortalHome.aspx

和安全版本:

https: //www.tlsadmin.com/tlsadmin/PortalHome.aspx

我遇到的问题是我的基于 WCF 的 Web 服务似乎无法在 HTTPS 下工作。我有什么遗漏或不理解的吗?我认为 SVC 文件的相对 URL 将涵盖所有内容

<asp:ScriptManager ID="ScriptManager1" runat="server" >
    <Services>
        <asp:ServiceReference Path="~/Services/Contacts.svc" />
        <asp:ServiceReference Path="~/Services/Domains.svc" />
        <asp:ServiceReference Path="~/Services/TreeViewNavigation.asmx" />
        <asp:ServiceReference Path="/Services/FullSoaSchedulerService.svc/json" />
    </Services>
</asp:ScriptManager>

也许我需要为 Web 服务添加额外的绑定才能通过 HTTPS 工作?

<service name="LC.www.nexthop.mx.POC.grid_WebService.Domains">
        <endpoint address="" behaviorConfiguration="LC.www.nexthop.mx.POC.grid_WebService.DomainsAspNetAjaxBehavior"
          binding="webHttpBinding" contract="LC.www.nexthop.mx.POC.grid_WebService.Domains" />
      </service>

I have two versions of the same proof-of-concept site: The unsecure version:

http://www.tlsadmin.com/tlsadmin/PortalHome.aspx

and the secure version:

https://www.tlsadmin.com/tlsadmin/PortalHome.aspx

The problem I have is that my WCF-Based web services don't seem to work under HTTPS. Is there something I'm missing, or not understanding about this? I thought a relative URL for the SVC file would cover everything

<asp:ScriptManager ID="ScriptManager1" runat="server" >
    <Services>
        <asp:ServiceReference Path="~/Services/Contacts.svc" />
        <asp:ServiceReference Path="~/Services/Domains.svc" />
        <asp:ServiceReference Path="~/Services/TreeViewNavigation.asmx" />
        <asp:ServiceReference Path="/Services/FullSoaSchedulerService.svc/json" />
    </Services>
</asp:ScriptManager>

Perhaps I need to add an additional binding for the webservice to work over HTTPS?

<service name="LC.www.nexthop.mx.POC.grid_WebService.Domains">
        <endpoint address="" behaviorConfiguration="LC.www.nexthop.mx.POC.grid_WebService.DomainsAspNetAjaxBehavior"
          binding="webHttpBinding" contract="LC.www.nexthop.mx.POC.grid_WebService.Domains" />
      </service>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

善良天后 2024-09-22 12:41:06

您希望将自定义绑定添加到您的配置中,通过将绑定的安全模式设置为传输来启用 HTTPS。

 <bindings>
   <webHttpBinding>
     <binding name="httpsBinding">
       <security mode="Transport">
       </security>
     </binding>
   </webHttpBinding>
 </bindings>

默认安全模式是 None,它不能很好地与 HTTPS 配合使用。

然后将该绑定分配给您的端点:

<service name="LC.www.nexthop.mx.POC.grid_WebService.Domains">
        <endpoint address="" behaviorConfiguration="LC.www.nexthop.mx.POC.grid_WebService.DomainsAspNetAjaxBehavior"
          binding="webHttpBinding" bindingConfiguration="httpsBinding" contract="LC.www.nexthop.mx.POC.grid_WebService.Domains" />
</service>

博客文章帮助了我。

希望这有帮助!

You want to add a custom binding to your configuration to enable it for HTTPS by setting your binding's security mode to transport.

 <bindings>
   <webHttpBinding>
     <binding name="httpsBinding">
       <security mode="Transport">
       </security>
     </binding>
   </webHttpBinding>
 </bindings>

The default security mode is None which doesn't play well with HTTPS.

Then assign that binding to your endpoint:

<service name="LC.www.nexthop.mx.POC.grid_WebService.Domains">
        <endpoint address="" behaviorConfiguration="LC.www.nexthop.mx.POC.grid_WebService.DomainsAspNetAjaxBehavior"
          binding="webHttpBinding" bindingConfiguration="httpsBinding" contract="LC.www.nexthop.mx.POC.grid_WebService.Domains" />
</service>

This blog post helped me out when I first ran into this situation.

Hope this helps!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文