WCF XML信息未显示在实时服务器上

时间:2019-10-24 06:33:53

标签: c# web-services wcf

我创建了一个WCF Serive。当我部署在本地测试服务器上时,它正在显示xml信息。但是,当我尝试在实时服务器上部署时,它没有在实时服务器上显示XML信息。当我单击Test URL时,我的本地测试URL为Link,它显示了我的函数xml信息。但是当我实时部署时,它不会显示xml信息Live URL。我的本地服务器是http,实时服务器是https。

Web配置服务模型

<system.serviceModel>
<client />
<services>
  <service name="xCBLSoapWebService.MeridianService">
    <endpoint binding="wsHttpBinding" bindingConfiguration="NewBinding0" contract="xCBLSoapWebService.IMeridianService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="NewBinding0" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
    <binding name="WSHttpBinding_IMeridianService">
      <security mode="None" />
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" />
      <dataContractSerializer maxItemsInObjectGraph="52428800" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="AjaxBehavior">
      <enableWebScript />
      <webHttp helpEnabled="true" />
    </behavior>
  </endpointBehaviors>
</behaviors>
<protocolMapping>
  <add binding="wsHttpBinding" scheme="http" bindingConfiguration="NewBinding0" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

您能帮我解决这个问题吗?谢谢

2 个答案:

答案 0 :(得分:1)

通过单击链接,您似乎已经找到了解决此问题的方法,我们必须设置以下代码段以通过HTTPS公开服务元数据。

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>

我们需要注意的另一件事是,由于服务器仅启用了Https协议,因此我们必须配置其他服务端点以启用通过HTTPS可用的服务。
请参考下面的代码。

    <bindings>
      <wsHttpBinding>
        <binding name="httpsbinding">
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="wsHttpBinding" scheme="https" bindingConfiguration="httpsbinding"/>
</protocolMapping>

请随时告诉我是否有什么可以帮忙的。

答案 1 :(得分:0)

这很可能是HTTPS要求启用“ httpsGetEnabled”的结果。

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>