首页 > 解决方案 > 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

enter image description here

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 ;

标签: c#httpsowin

解决方案


除了更改 API 的基地址外,您还需要安装证书并使用 netsh 配置 SSL/TLS,例如:

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

以下博客文章更详细地概述了所需的步骤:

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


推荐阅读