如何在调用服务参考中的方法之前定义代理服务器凭据

时间:2019-06-27 09:58:49

标签: c# web-services proxy

我正在从具有凭证的服务引用中调用Web服务,但是最近他们(基础架构团队)在服务器内添加了代理,因此现在我无法连接到服务器以使用Web服务。

到目前为止,我的代码是:

using (AttachmentServicesClient client = new AttachmentServicesClient())
{
    client.ClientCredentials.UserName.UserName = userName;
    client.ClientCredentials.UserName.Password = password;
    #region i tried this but didn't work
    client.ClientCredentials.Windows.ClientCredential.Domain = proxyaddress;
    client.ClientCredentials.Windows.ClientCredential.UserName =   
usernameProxy;                   
    client.ClientCredentials.Windows.ClientCredential.Password = 
passwordProxy;
    #endregion
    response = client.CreateDocument(doc);
}

我想念什么?

0 个答案:

没有答案