You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WCF服务返回空认证信息问题求助:Basic调用异常排查

问题:WCF服务Basic认证调用时返回空认证头

我正在修复一个此前正常运行的WCF服务,尝试使用Basic认证调用时,收到的服务响应中支持的认证头为空字符串。我怀疑客户修改了支持的认证方式,但多次询问项目相关人员仍无法获知具体支持的认证类型。

异常情况

正常情况下,服务会标注支持的认证头为Basic或其他类型,但当前返回的支持认证头为空字符串。

调用代码

// Create the binding.
var myBinding = new BasicHttpBinding()
{
    ReceiveTimeout = new TimeSpan(0, 20, 0),
    MaxReceivedMessageSize = 1000000000,
    Security =
    {
        Mode = BasicHttpSecurityMode.TransportCredentialOnly,
        Transport =
        {
            ClientCredentialType = HttpClientCredentialType.Basic, 
            ProxyCredentialType = HttpProxyCredentialType.Basic
        },
    }
};

var ea = new
    EndpointAddress(ConnectionStringOptions.SAPMEMaterialListEndPoint);

var materialList = (List<MaterialListItem>)await FetchDataPersistently(async () =>
{
    // Create the client.
    var cc = new XacuteWSSoapClient(myBinding, ea);
    // The client must provide a user name and password. The code
    // to return the user name and password is not shown here. Use
    // a database to store the user name and passwords, or use the
    // ASP.NET Membership provider database.
    cc.ClientCredentials.UserName.UserName = ConnectionStringOptions.OneERPUser;
    cc.ClientCredentials.UserName.Password = ConnectionStringOptions.OneERPPassword;

    var response = await cc.XacuteAsync(ConnectionStringOptions.OneERPUser,
    ConnectionStringOptions.OneERPPassword, new InputParams
    {
        Site = ConnectionStringOptions.OneERPSite
    });
});

疑问

服务返回空字符串的具体含义是什么?是配置错误还是隐含某种未明确的信息?

内容的提问来源于stack exchange,提问作者Zifnab

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 06:45:35