static void Main(string[] args)
{
Uri baseAddress = new Uri("http://localhost:8080/SimpleService");
try
{
WebHttpBinding binding = new WebHttpBinding();
binding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
WebChannelFactory
//If Default domain is not added in IIS, provide it below - else not needed
cf.Credentials.UserName.UserName = "user";
cf.Credentials.UserName.Password = "password";
SimpleInterface channel = cf.CreateChannel();
Console.WriteLine("Reply Hi : {0}", channel.ReplyHi("Hello, world"));
Console.WriteLine("Reply Hii : {0}",channel.ReplyHii("Hello, world"));
}
catch (CommunicationException ex)
{
Console.WriteLine("An exception occurred: " + ex.Message);
}
}
No comments:
Post a Comment