如何在 windows 服务器 2016 中安装没有 IIS 的 ssl 证书?
How to install ssl certificate without IIS in windows server 2016?
我有一个基于 asp.net 核心 MVC 的项目;我想使用 SSL 证书来使用 https,但是当 运行 我的项目时,它没有显示 https 地址。我无法在 windows server.but 中使用 IIS,在 windows 10 一切正常。
我正在尝试在 windows 服务器中安装 SSL 证书以便在我的项目中使用 https。
public static IWebHost BuildWebHost(string[] args)
{
var host = "0.0.0.0";
var http_port = 40000;
var https_port = 40001;
if (args.Length > 0) host = args[0].Trim();
if (args.Length > 1) http_port = Convert.ToInt32(args[1].Trim());
if (args.Length > 2) https_port = Convert.ToInt32(args[2].Trim());
return
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
//
.UseKestrel(options =>
{
options.Limits.MaxRequestBodySize = null;
options.Limits.MaxRequestBufferSize = null;
options.Limits.MaxRequestHeaderCount = 1000;
options.Limits.MaxRequestHeadersTotalSize = 256 * 1024;
options.Listen(IPAddress.Parse(host), http_port);
using (var store = new X509Store(StoreName.My))
{
store.Open(OpenFlags.ReadOnly);
var certs = store.Certificates.Find(X509FindType.FindBySubjectName, "localhost", false);
if (certs.Count > 0)
{
var certificate = certs[0];
options.Listen(IPAddress.Parse(host), https_port, listenOptions =>
{
listenOptions.UseHttps(certificate);
});
}
}
}).Build();
}
我希望输出见 https://0.0.0.0:40001, but in windows server I only have http://0.0.0.0:40000。
Windows 服务器的图片
Windows server
Windows10 的图像:
Windows 10
第 1 步:在您的计算机中启用 IIS 功能以托管。然后进入管理工具>IIS管理器。
第 2 步:Select 您要为其启用 ssl 的站点。
第 3 步:在右侧的操作面板中,您将拥有编辑站点和 select 绑定
第 4 步:在站点绑定中,如果已定义,请单击关闭或
1.click 添加
2.select https
在ssl证书中,select证书
点击确定然后关闭
第 5 步:在连接面板中,在站点> 下再次单击站点以显示 selected 网站主页。
第 6 步:在 selected 网站中,点击 SSL 设置
第 7 步:在 ssl 设置中,select 需要 ssl 并且在客户端证书下 select 接受。
第 8 步:申请
如果我的理解正确,您在开发环境中使用 SSL 时遇到了困难。我建议你看看这里 Enforce HTTPS in ASP.NET CORE. At this point on the page, Trust the ASP.NET Core Development Certificates..,你可能会找到解决问题的方法。
我有一个基于 asp.net 核心 MVC 的项目;我想使用 SSL 证书来使用 https,但是当 运行 我的项目时,它没有显示 https 地址。我无法在 windows server.but 中使用 IIS,在 windows 10 一切正常。
我正在尝试在 windows 服务器中安装 SSL 证书以便在我的项目中使用 https。
public static IWebHost BuildWebHost(string[] args)
{
var host = "0.0.0.0";
var http_port = 40000;
var https_port = 40001;
if (args.Length > 0) host = args[0].Trim();
if (args.Length > 1) http_port = Convert.ToInt32(args[1].Trim());
if (args.Length > 2) https_port = Convert.ToInt32(args[2].Trim());
return
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
//
.UseKestrel(options =>
{
options.Limits.MaxRequestBodySize = null;
options.Limits.MaxRequestBufferSize = null;
options.Limits.MaxRequestHeaderCount = 1000;
options.Limits.MaxRequestHeadersTotalSize = 256 * 1024;
options.Listen(IPAddress.Parse(host), http_port);
using (var store = new X509Store(StoreName.My))
{
store.Open(OpenFlags.ReadOnly);
var certs = store.Certificates.Find(X509FindType.FindBySubjectName, "localhost", false);
if (certs.Count > 0)
{
var certificate = certs[0];
options.Listen(IPAddress.Parse(host), https_port, listenOptions =>
{
listenOptions.UseHttps(certificate);
});
}
}
}).Build();
}
我希望输出见 https://0.0.0.0:40001, but in windows server I only have http://0.0.0.0:40000。
Windows 服务器的图片 Windows server
Windows10 的图像: Windows 10
第 1 步:在您的计算机中启用 IIS 功能以托管。然后进入管理工具>IIS管理器。
第 2 步:Select 您要为其启用 ssl 的站点。
第 3 步:在右侧的操作面板中,您将拥有编辑站点和 select 绑定
第 4 步:在站点绑定中,如果已定义,请单击关闭或
1.click 添加
2.select https
在ssl证书中,select证书
点击确定然后关闭
第 5 步:在连接面板中,在站点> 下再次单击站点以显示 selected 网站主页。
第 6 步:在 selected 网站中,点击 SSL 设置
第 7 步:在 ssl 设置中,select 需要 ssl 并且在客户端证书下 select 接受。
第 8 步:申请
如果我的理解正确,您在开发环境中使用 SSL 时遇到了困难。我建议你看看这里 Enforce HTTPS in ASP.NET CORE. At this point on the page, Trust the ASP.NET Core Development Certificates..,你可能会找到解决问题的方法。