c# - 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 ;
解决方案
除了更改 API 的基地址外,您还需要安装证书并使用 netsh 配置 SSL/TLS,例如:
netsh http add sslcert ipport=0.0.0.0:81
certhash=<CERT_THUMBPRINT> appid=<APP_ID>
以下博客文章更详细地概述了所需的步骤:
https://opensequence.net/post/113488532197/hosting-an-owin-application-in-windows-using
推荐阅读
- ios - 使用 100% CloudKit 和 SwiftUI 在应用程序中设置社交组件的流程?
- node.js - DISCORD.JS 如何获取邀请新成员的人的姓名?
- sql - 如何计算对象/记录中的总项目并仅计算值 = true
- python - python3 - 如何生成名称是输入文件名修改的输出文件?
- python - 在 Python 中自定义聚合列时分组、过滤顶部行
- android - IAP 购买与 Apple 订阅有关
- javascript - 如何检查@everyone 是否可以在特定的 Discord 频道中发送消息?
- git - git.exc.InvalidGitRepositoryError
- java - 如何在 Java 中获取快捷方式/链接的图标?
- python - CrawlSpider 回调不起作用,下一页被检索一次