【问题标题】:SoapUI authentication vs C#SoapUI 身份验证与 C#
【发布时间】:2015-01-15 23:33:38
【问题描述】:

我有一个使用以下凭据在 SoapUI 中运行良好的 Web 服务:

Authentication: Basic
Username: testUser
Password: testPassword
Domain: IPaddress

当我尝试使用此代码在我的 C# 应用程序中使用它时

soapWS.Service soapWS = new soapWS.Service();
soapWS.Credentials = new NetworkCredential("testUser", "testPassword", "IPaddress");

我收到以下错误

Exception startSession: FailedLoginException for user IPaddress\testUser;嵌套异常是:

我对 SoapUI 做了更多研究,SoapUI 中的领域是

Domain : The domain to use if the request requires NTLM authentication)

我试过了

soapWS.Credentials = new NetworkCredential("testUser@IPaddress", "testPassword");

这也不起作用。

【问题讨论】:

  • 是否真的没有嵌套异常的细节,还是你遗漏了消息的重要部分?
  • 其实is后面什么都没有:

标签: c# .net web-services soapui basic-authentication


【解决方案1】:

NetworkCredential 构造函数的最后一个参数应该是域名和 IP 地址。 下面一行

soapWS.Credentials = new NetworkCredential("testUser", "testPassword", "IPaddress");

应该是

soapWS.Credentials = new NetworkCredential("testUser", "testPassword", "your domain name");

【讨论】:

  • 好的,我看到这个构造函数的问题是对实际 Windows 域的身份验证,因此是域\用户错误。除了 NetworkCredential 之外,是否还有其他对象可用于基本 Web 服务授权?
  • 试试这个soapWS.Credentials = new NetworkCredential("testUser", "testPassword")
【解决方案2】:

我所要做的就是在我的对象中删除“IP地址”。

soapWS.Credentials = new NetworkCredential("testUser", "testPassword");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-29
    • 1970-01-01
    • 1970-01-01
    • 2012-03-15
    • 2016-04-12
    • 2020-09-19
    相关资源
    最近更新 更多