我在一个reference.cs标准2.0项目中生成一个reference.cs,然后从一个.NET 4.7.1项目中使用它,但是我得到了"Could not establish secure channel for SSL/TLS with authority"
如果我使用Add Service Reference生成它,除了visual 2015。我得到了一个类似的reference.cs类,如果我在我的.NET标准2.0项目中复制它,它就能工作了,但是我失去了Web服务的异步调用实现。有什么办法让这件事成功吗?
发布于 2018-09-13 16:52:15
确保配置绑定。它们位于app.config框架项目的.net中,但应该封装在.NET标准/.NET核心中的BasicHttpBinding中。
这样,您就可以根据需要指定安全设置:
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;来自Nuget package System.ServiceModel.Http:
namespace System.ServiceModel
{
public class BasicHttpBinding : HttpBindingBase
{
public BasicHttpBinding();
public BasicHttpBinding(BasicHttpSecurityMode securityMode);
public BasicHttpSecurity Security { get; set; }
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingParameterCollection parameters);
public override BindingElementCollection CreateBindingElements();
}
}https://stackoverflow.com/questions/52316982
复制相似问题