从.NET Framework 4.7.1移至.NET Corenetstandard 2.0之后的ProtocolException

问题描述

此客户端库使用旧SOAP服务中的服务。在.NET Frameowork中运行正常。但是在将代码迁移到.NET Core之后,我收到以下错误

The content type text/xml; charset="UTF-8" of the response message does not match the content type of the binding (text/xml; charset=utf-8). 

请求的响应标头为:

HTTP/1.1 200 OK
Server: Nginx
Date: Thu,01 Oct 2020 07:51:48 GMT
Content-Type: text/xml; charset="UTF-8"
etc...

代码似乎已超出了“ UTF-8”的大写字母范围。 在代码中,我们使用BasicHttpBinding:

private BasicHttpBinding _binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);

感觉有点尴尬,但是应该有一种方法可以忽略协议并支持旧版服务。有人知道如何配置绑定以支持此操作吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)