将 OWIN Web API 从 http 转换为 https

Convert OWIN Web API from http to https

我有 OWIN windows 来自 API 的 http 我想将其转换为 https。我已将代码从 http 更改为 https,但在 运行 之后我无法得到任何响应

POSTMAN 的回复

代码:

  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());
            }

        }
    }

任何解决方案;

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

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

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

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