C# 如何使用WS(Http)和#x2B;ClientCredentials.UserName

C# 如何使用WS(Http)和#x2B;ClientCredentials.UserName,c#,wcf,soap,C#,Wcf,Soap,错误是 其他信息:服务器返回了无效的SOAP错误。有关更多信息,请参阅InnerException 我的例外是: {“应为开始元素'faultcode'命名空间'第1行。”找到元素'faultcode'命名空间“”,172。“位置} 怎么了? 多谢各位 BasicHttpBinding binding = new BasicHttpBinding(); endP = new EndpointAddress("http:......"); WebPortClient client = new We

错误是 其他信息:服务器返回了无效的SOAP错误。有关更多信息,请参阅InnerException

我的例外是: {“应为开始元素'faultcode'命名空间'第1行。”找到元素'faultcode'命名空间“”,172。“位置}

怎么了? 多谢各位

BasicHttpBinding binding = new BasicHttpBinding();
endP = new EndpointAddress("http:......");
WebPortClient client = new WebPortClient (binding, endP);
client.ClientCredentials.UserName.UserName = "User";
client.ClientCredentials.UserName.Password = "Pass";