示例#1
0
        static void Main(string[] args)
        {
            var client = new HelloWorldServiceRef.HelloWorldServiceClient();

            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";
            Console.WriteLine(client.GetMessage("Basic Authentication caller"));
        }
示例#2
0
        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"));
        }