我使用通道工厂创建了一个 WCF 客户端。但我无法连接到另一台机器上的服务器。我收到 (407) 需要 Proxy Authentication 异常。
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();
这是我的客户端连接代码片段。当我调用服务的方法时出现异常。