Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net HTTP请求未经客户端身份验证方案';谈判';。身份验证标头。。。是';协商、Kerberos、NTLM和x27;_Vb.net_Wcf_Authentication_Ntlm - Fatal编程技术网

Vb.net HTTP请求未经客户端身份验证方案';谈判';。身份验证标头。。。是';协商、Kerberos、NTLM和x27;

Vb.net HTTP请求未经客户端身份验证方案';谈判';。身份验证标头。。。是';协商、Kerberos、NTLM和x27;,vb.net,wcf,authentication,ntlm,Vb.net,Wcf,Authentication,Ntlm,我们正在尝试使用VB.Net从外部web服务获取数据 我们添加了一个服务引用,提供了正确的WSDL 我们获取数据的代码是: Dim MyClient As New ExtConn.GetConnectorSoapClient() MyClient.ClientCredentials.UserName.UserName = "AOL\12345.abcde" MyClient.ClientCredentials.UserName.Password = "pass123"

我们正在尝试使用VB.Net从外部web服务获取数据

我们添加了一个服务引用,提供了正确的WSDL

我们获取数据的代码是:

    Dim MyClient As New ExtConn.GetConnectorSoapClient()

    MyClient.ClientCredentials.UserName.UserName = "AOL\12345.abcde"
    MyClient.ClientCredentials.UserName.Password = "pass123"

    Dim MyReq As New ExtConn.GetDataRequest
    Dim MyResponse As New ExtConn.GetDataResponse

    Dim MyCred As New System.ServiceModel.Description.ClientCredentials()

    Dim MyReqBody As New ExtConn.GetDataRequestBody("Environment123", "AOL\12345.abcde", "pass123", "12345.abcde", "GetData", "")

    MyReq.Body = MyReqBody

    MyResponse = MyClient.ExtConn_GetConnectorSoap_GetData(MyReq)

    MsgBox(MyResponse.Body.GetDataResult)
我们的app.config是:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>

    <bindings>
        <basicHttpsBinding>
            <binding name="GetConnectorSoap">
              <security mode="Transport"  >
                <transport clientCredentialType="Ntlm" realm="" />
                <message clientCredentialType="UserName"  />
              </security>
            </binding>

        </basicHttpsBinding>
    </bindings>
    <client>
        <endpoint address="https://ota.externalservice.nl/ourservices/getconnector.asmx"
            binding="basicHttpsBinding" bindingConfiguration="GetConnectorSoap"
            contract="ExtConn.GetConnectorSoap" name="GetConnectorSoap" />
    </client>
</system.serviceModel>
</configuration>

答复是:

HTTP请求未经客户端身份验证方案“Ntlm”授权。从服务器接收的身份验证标头为“协商、Kerberos、NTLM”


我的问题是:我们做错了什么?如果NTLM被接受为身份验证模式,为什么会出现此错误?

您可以尝试将其添加为web引用(添加服务引用>高级..>添加web引用)


这个答案没有帮助,很可能是他们已经做过的。
GetConnector connector = new GetConnector();
connector.Credentials = new NetworkCredential("username", "password", "domain");
string response = connector.GetData();