Web services 为什么要添加<;服务>;我的http/https WCF数据服务的节点导致在I';打开';它在浏览器中吗?

Web services 为什么要添加<;服务>;我的http/https WCF数据服务的节点导致在I';打开';它在浏览器中吗?,web-services,wcf,Web Services,Wcf,我有一个承载WCF数据服务(System.Data 5.6.1)的azure web角色。我为两个端点http和https配置了web角色。我能够部署到azure,并且我能够通过打开一个指向两个端点的浏览器(例如,和)来做一个简单的测试 并得到反馈 我知道我将来对此web服务的一些查询可能会超过WCF数据服务使用的webHttpBinding的默认限制,因此我在我的web.config中添加了一个非常基本的配置: <system.serviceModel> <diagn

我有一个承载WCF数据服务(System.Data 5.6.1)的azure web角色。我为两个端点http和https配置了web角色。我能够部署到azure,并且我能够通过打开一个指向两个端点的浏览器(例如,和)来做一个简单的测试 并得到反馈

我知道我将来对此web服务的一些查询可能会超过WCF数据服务使用的webHttpBinding的默认限制,因此我在我的web.config中添加了一个非常基本的配置:

<system.serviceModel>
    <diagnostics>
        <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
    <service name="BNN.Nuform.Demog.WebService.DemogDataService">
    <endpoint bindingConfiguration="msgSize" address="" binding="webHttpBinding" contract="System.Data.Services.IRequestHandler" />
  </service>
</services>
<bindings>
  <webHttpBinding>
    <binding name="msgSize" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
    </binding>
  </webHttpBinding>
</bindings>
</system.serviceModel>

通过http端点,一切正常

但在https端点上,它根本不起作用。如果我打开浏览器并尝试任何操作,我总是返回未找到的资源。
发生了什么事

您需要为希望访问服务的每种不同方式创建一个绑定配置

如果希望能够通过HTTP或HTTPS访问服务,可以创建两个单独的绑定配置,并与两个服务端点匹配

<system.serviceModel>
    <diagnostics>
        <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
    </diagnostics>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
        <service name="BNN.Nuform.Demog.WebService.DemogDataService">
            <endpoint address="" binding="webHttpBinding" bindingConfiguration="msgSize" contract="System.Data.Services.IRequestHandler" />
            <endpoint address="" binding="webHttpBinding" bindingConfiguration="secureBinding" contract="System.Data.Services.IRequestHandler" />
        </service>
    </services>
    <bindings>
        <webHttpBinding>
            <binding name="msgSize" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
            </binding>
            <binding name="secureBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
                <security mode="Transport" />
            </binding>
        </webHttpBinding>
    </bindings>
</system.serviceModel>


服务部分中定义的第二个端点上面的示例允许您引用安全绑定配置。

您是否尝试过使用传输安全性添加绑定?不过,我相信您需要添加另一个端点或其他端点;完成此操作后,https端点工作,但现在HTTP端点停止工作。看起来我无法让它们都工作,要么是一个,要么是另一个?????您需要两个绑定-一个用于https(具有传输安全性),另一个用于http(不具有传输安全性)。