Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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
在我的WCF客户端中,在哪里指定代理凭据?_Wcf_Proxy_Credentials - Fatal编程技术网

在我的WCF客户端中,在哪里指定代理凭据?

在我的WCF客户端中,在哪里指定代理凭据?,wcf,proxy,credentials,Wcf,Proxy,Credentials,我已经使用channel factory创建了一个WCF客户端。 但我无法连接到另一台机器中的服务器。我得到一个(407)Prxy身份验证必需的异常 WSHttpBinding wsBinding = new WSHttpBinding(); wsBinding.BypassProxyOnLocal = true; EndpointAddress endpoint = new EndpointAddress("http://machineNa

我已经使用channel factory创建了一个WCF客户端。 但我无法连接到另一台机器中的服务器。我得到一个(407)Prxy身份验证必需的异常

WSHttpBinding wsBinding = new WSHttpBinding();
        wsBinding.BypassProxyOnLocal = true;

        EndpointAddress endpoint =
          new EndpointAddress("http://machineName:7676/MyWCFService");
        ChannelFactory<IService> sericeInterface =
            new ChannelFactory<IService>(wsBinding, endpoint);

        sericeInterface.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
        sericeInterface = sericeInterface.CreateChannel();
WSHttpBinding wsBinding=新的WSHttpBinding();
wsBinding.BypassProxyOnLocal=true;
端点地址端点=
新端点地址(“http://machineName:7676/MyWCFService");
信道工厂服务接口=
新的ChannelFactory(wsBinding,端点);
SerieInterface.Credentials.Windows.ClientCredential=System.Net.CredentialCache.DefaultNetworkCredentials;
serieinterface=serieinterface.CreateChannel();
这是我的客户端连接代码nippet。当我调用一个服务方法时,我遇到了一个异常。

请查看此链接,尝试找到一个和您的场景非常匹配的场景。它提供了如何为不同情况/绑定设置各种凭据的检查列表和示例

这也可能有助于Windows身份验证,您似乎正在使用它

要分配凭据,您需要从MSDN链接获取以下内容:

CalculatorClient cc = new 
    CalculatorClient("WSHttpBinding_ICalculator");
// This code returns the WindowsClientCredential type.            
cc.ClientCredentials.Windows.ClientCredential.UserName = GetUserName();
cc.ClientCredentials.Windows.ClientCredential.Password = GetPassword();
看看这个链接,试着找到一个与你的场景非常匹配的场景。它提供了如何为不同情况/绑定设置各种凭据的检查列表和示例

这也可能有助于Windows身份验证,您似乎正在使用它

要分配凭据,您需要从MSDN链接获取以下内容:

CalculatorClient cc = new 
    CalculatorClient("WSHttpBinding_ICalculator");
// This code returns the WindowsClientCredential type.            
cc.ClientCredentials.Windows.ClientCredential.UserName = GetUserName();
cc.ClientCredentials.Windows.ClientCredential.Password = GetPassword();

问题是关于代理凭据,而不是客户端凭据。是否可以删除或修复此问题?问题是关于代理凭据,而不是客户端凭据。是否可以删除或修复此问题?