Authentication .NET核心Soap平台不支持异常,无法创建自定义绑定
我试图从SOAP服务获取数据,但无法使其工作。问题是,我认为.NETCore并没有实现所有的绑定方法。我也有工作示例,但它是用.NETFramework编写的 所以问题是, 这是工作配置“Web.config” 而且,正如您所看到的,我需要一个安全绑定,它需要Authentication .NET核心Soap平台不支持异常,无法创建自定义绑定,authentication,asp.net-core,soap,basic-authentication,Authentication,Asp.net Core,Soap,Basic Authentication,我试图从SOAP服务获取数据,但无法使其工作。问题是,我认为.NETCore并没有实现所有的绑定方法。我也有工作示例,但它是用.NETFramework编写的 所以问题是, 这是工作配置“Web.config” 而且,正如您所看到的,我需要一个安全绑定,它需要 <security authenticationMode="UserNameOverTransport" enableUnsecuredResponse="true" includeTimestamp="false" />
<security authenticationMode="UserNameOverTransport" enableUnsecuredResponse="true" includeTimestamp="false" />
但即使是在代码中,我也不能自己创建绑定。即使我这样做了,代码也不会工作,因为我上面提到的问题。
谢谢你抽出时间我想你没解决过这个问题吧?现在在core 3.1中体验到了这一点,实际上它是通过创建自定义安全头并绑定来解决的。除了@OzanTürkerDemir的评论之外,我不得不这么做,我想你从来没有解决过这个问题吗?现在在core 3.1中体验到了这一点,实际上它是通过创建自定义安全头并绑定来解决的
CustomBinding binding = new CustomBinding()
{
Name = "example",
ReceiveTimeout = new TimeSpan(0, 0, 100, 0, 0),
SendTimeout = new TimeSpan(0, 0, 100, 0, 0),
};
var element1 = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
var element2 = new HttpsTransportBindingElement()
{
ManualAddressing = false,
MaxReceivedMessageSize = 2147483647,
AllowCookies = false,
AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous,
BypassProxyOnLocal = false,
MaxBufferSize = 2147483647,
ProxyAuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous,
TransferMode = TransferMode.Buffered,
UseDefaultWebProxy = true
};
var element3 = new TextMessageEncodingBindingElement(MessageVersion.Soap11, System.Text.Encoding.UTF8);
binding.Elements.Add(element1);
binding.Elements.Add(element3);
binding.Elements.Add(element2);
<security authenticationMode="UserNameOverTransport" enableUnsecuredResponse="true" includeTimestamp="false" />