static void Main(string[] args) { /* var client = new HelloWorldServiceRef.HelloWorldServiceClient(); // replace the user credential to your own one in following code client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; Console.WriteLine(client.GetMessage("Basic Authentication caller")); */ var client = new HelloWorldServiceRef.HelloWorldServiceClient(); client.ChannelFactory.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; Console.WriteLine(client.GetMessage("Windows Authentication caller")); }
static void Main(string[] args) { HelloWorldServiceRef.HelloWorldServiceClient client = new HelloWorldServiceRef.HelloWorldServiceClient(); Console.WriteLine(client.GetMessage("Mike Liu")); }