简体   繁体   中英

Convert OWIN Web API from http to https

I have OWIN windows from API in http I want to convert it to https. I have change in code from http to https but after ran it I couldnt get any response

The response from POSTMAN

在此处输入图片说明

Code :

  static class Program
    {
        [STAThread]
        static void Main()
        {
            string baseAddress = "https://+:81";

            // Start OWIN host 
            using (WebApp.Start<Startup>(url: baseAddress))
            {

                Console.ReadLine();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }

        }
    }

Any Solutions ;

In addition to changing the base address of your API, you also need to install a certificate and configure SSL/TLS using netsh, eg:

netsh http add sslcert ipport=0.0.0.0:81 
  certhash=‎<CERT_THUMBPRINT> appid=<APP_ID>

The following blog post outlines the steps that are required in greater detail:

https://opensequence.net/post/113488532197/hosting-an-owin-application-in-windows-using

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM