WCF 配置问题:元数据包含无法解析的引用
WCF Configuration problems: metadata contains a reference that cannot be resolved
我有一个 WCF 服务发布到我正在使用的网站。这是服务的开发 URL:https://aspireportal.azurewebsites.net/BridgeService.svc
当我尝试使用 Wcf 测试客户端连接到该服务时,我收到以下错误。
Error: Cannot obtain Metadata from
https://aspireportal.azurewebsites.net/BridgeService.svc If this is a
Windows (R) Communication Foundation service to which you have access,
please check that you have enabled metadata publishing at the
specified address. For help enabling metadata publishing, please
refer to the MSDN documentation at
http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange
Error URI: https://[redacted no longer needed]/BridgeService.svc
Metadata contains a reference that cannot be resolved:
'https://[redacted no longer needed]/BridgeService.svc'. An
error occurred while making the HTTP request to
https://[redacted no longer needed]/BridgeService.svc. This could
be due to the fact that the server certificate is not configured
properly with HTTP.SYS in the HTTPS case. This could also be caused by
a mismatch of the security binding between the client and the server.
The underlying connection was closed: An unexpected error occurred on
a send. Unable to read data from the transport connection: An
existing connection was forcibly closed by the remote host. An
existing connection was forcibly closed by the remote hostHTTP GET
Error URI: https://[redacted no longer needed]/BridgeService.svc
There was an error downloading
'https://[redacted no longer needed]/BridgeService.svc'. The
underlying connection was closed: An unexpected error occurred on a
send. Unable to read data from the transport connection: An
existing connection was forcibly closed by the remote host. An
existing connection was forcibly closed by the remote host
作为参考,这里是我的 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!!
好吧,已经晚了,我的大脑还没有完全发挥作用。我刚刚启动了一个项目,添加了服务参考,效果很好。我想,这可能是 TLS1.2 的事情,现在我想起来我似乎记得 WCF 测试客户端可能不完全符合新协议。
我应该在 post 之前完成这个测试。
我有一个 WCF 服务发布到我正在使用的网站。这是服务的开发 URL:https://aspireportal.azurewebsites.net/BridgeService.svc
当我尝试使用 Wcf 测试客户端连接到该服务时,我收到以下错误。
Error: Cannot obtain Metadata from https://aspireportal.azurewebsites.net/BridgeService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: https://[redacted no longer needed]/BridgeService.svc Metadata contains a reference that cannot be resolved: 'https://[redacted no longer needed]/BridgeService.svc'. An error occurred while making the HTTP request to https://[redacted no longer needed]/BridgeService.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server. The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote hostHTTP GET Error URI: https://[redacted no longer needed]/BridgeService.svc There was an error downloading 'https://[redacted no longer needed]/BridgeService.svc'. The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host
作为参考,这里是我的 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!!
好吧,已经晚了,我的大脑还没有完全发挥作用。我刚刚启动了一个项目,添加了服务参考,效果很好。我想,这可能是 TLS1.2 的事情,现在我想起来我似乎记得 WCF 测试客户端可能不完全符合新协议。
我应该在 post 之前完成这个测试。