WCF配置问题:元数据包含无法解析的引用

时间:2019-01-18 03:34:05

标签: c# wcf

我有一个WCF服务发布到我现在正在处理的站点上。这是该服务的开发URL:https://aspireportal.azurewebsites.net/BridgeService.svc

当我尝试使用Wcf测试客户端连接到服务时,我得到以下错误。

  

错误:无法从中获取元数据   https://aspireportal.azurewebsites.net/BridgeService.svc如果这是一个   您可以访问的Windows(R)Communication Foundation服务,   请在以下位置检查是否已启用元数据发布   指定的地址。有关启用元数据发布的帮助,请   请参阅MSDN文档,网址为   http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata交换   错误URI:https://[redacted不再需要] /BridgeService.svc   元数据包含无法解析的引用:   'https://[redacted不再需要] /BridgeService.svc'。一个   发出HTTP请求时发生错误   https://[redacted不再需要] /BridgeService.svc。这可能   由于未配置服务器证书   在HTTPS情况下正确使用HTTP.SYS。这也可能是由于   客户端和服务器之间的安全绑定不匹配。   基础连接已关闭:发生意外错误   发送。无法从传输连接中读取数据:   现有连接被远程主机强行关闭。一个   现有连接被远程主机强行关闭HTTP GET   错误URI:https://[redacted不再需要] /BridgeService.svc   下载时出错   'https://[redacted不再需要] /BridgeService.svc'。的   基础连接已关闭:发生意外错误   发送。无法从传输连接中读取数据:   现有连接被远程主机强行关闭。一个   现有连接被远程主机强行关闭

作为参考,这是我的web.config文件的相关部分

                                                                    

<services>
  <service name="OnePortal.BridgeService">
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="secureHttpBinding"
              contract="OnePortal.IBridgeService"/>

    <endpoint address="mex"
              binding="mexHttpsBinding"
              contract="IMetadataExchange" />
  </service>
</services>

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IAddressVerify">
      <security mode="Transport" />
    </binding>
    <binding name="secureHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="[redacted by post]"
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAddressVerify"
      contract="AddressService.IAddressVerify" name="BasicHttpBinding_IAddressVerify" />
</client>

这是我的服务和课程。

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IBridgeService
    {
        [OperationContract]
        BridgeResponse AcceptBridgeRequest(BridgeRequest request);
    }
[DataContract]
    public class BridgeRequest 
    {
        [DataMember]
        public string AcordXML { get; set; }

        [DataMember]
        public string Vendor { get; set; }
    }

    [DataContract]
    public class BridgeResponse
    {
        [DataMember]
        public string ResponseXML { get; set; }

        [DataMember]
        public bool HasError { get; set; }

        [DataMember]
        public string ErrorMessage { get; set; }
    }


    public class BridgeService : IBridgeService
    {



        public BridgeResponse AcceptBridgeRequest(BridgeRequest request)
        {


            return new BridgeResponse
            {
                HasError = false,
                ErrorMessage = string.Empty,
                ResponseXML = xml_response.OuterXml
            };


        }


    }

正如您所看到的,我知道所有的类都被适当地修饰。这种感觉就像去年整个TLS1.2一样使所有人感到困惑,但是我似乎回想起错误消息,因为它更加清楚地说明了TLS连接(除非我弄错了。)

我希望新鲜的眼睛能看到我所缺少的东西。 TIA!

1 个答案:

答案 0 :(得分:0)

好的,它来晚了,我的大脑还没有完全发挥功能。我只是整理了一个项目,添加了服务参考,效果很好。我认为这可能是TLS1.2,现在我想起我似乎想起了WCF测试客户端可能与新协议不超级兼容。

发布帖子之前,我应该已经完成​​了此测试。

相关问题