In this article, I will explain how we can expose a WCF REST Service over secure HTPP (HTTPS)? Essentially there are three steps involved.
using System;using System.ServiceModel;using System.ServiceModel.Web;using WcfService13;using System.Diagnostics;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { WebServiceHost host = new WebServiceHost(typeof(Service1)); string uri = "https://localhost:443/Service1.svc/"; WebHttpBinding binding = new WebHttpBinding(); binding.Security.Mode = WebHttpSecurityMode.Transport; host.AddServiceEndpoint(typeof(IService1), binding, uri); host.Open(); Console.WriteLine("REST Service with HTTPS is running "); Process.Start(uri); Console.ReadKey(true); } }}Running ServiceNow when we run the console application the browser will be started automatically.
If you notice the URL, you will see that the service is running on SSL over HTTP. The URL is starting with HTTPS. In the next article, I will show you calling WCF REST Service over HTTPS from a client. Thanks for reading.
Exposing WCF REST Service Over HTTPS
How to Create a WCF RIA Service for a LightSwitch Application