BizTalk 发送端口抛出错误 System.Net.WebException:客户端身份验证方案禁止 HTTP 请求 'Anonymous'

BizTalk send port throws error System.Net.WebException: The HTTP request was forbidden with client authentication scheme 'Anonymous'

我遇到错误

System.Net.WebException: The HTTP request was forbidden with client authentication scheme 'Anonymous'.

来自 BizTalk 发送端口。

知道是什么导致了这个问题吗?

如果 Web 服务需要某种身份验证而 BizTalk 未发送任何凭据或其他身份验证,则会发生该错误。因此,您需要进入安全选项卡,将 Security mode 设置为 TransportTransportCredentialOnly 和 select a Transport client credential type

WCF-WebHttp 适配器存在一个已知问题,即使您在 Transport client credential type 中指定身份验证模式,它 return 也会出现如下错误。

Fault Description: System.Net.WebException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was ''.

The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was ''.

HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was ''

The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was ''.

出现这种情况是因为 WCF-WebHttp 适配器没有先发制人地发送凭据并期望服务器 return 可以接受的身份验证方案类型,但在某些 servers/APIs 中是 returning 为空白,因此出错。解决此问题的唯一方法是使用自定义 EndPointBehavior,该行为预先向有效负载添加适当的授权 headers。