コード例 #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
ファイル: Program.cs プロジェクト: ah16269/rest-web-api-wcf
        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"));
        }