在调试中为SSL配置launchSettings.json

编程入门 行业动态 更新时间:2024-10-27 14:25:52
本文介绍了在调试中为SSL配置launchSettings.json-ASP.NET Core/Visual Studio代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在按照此教程进行操作将Facebook身份验证添加到我的Web应用程序.

I am following this tutorial to add Facebook authentication to my web app.

作为该过程的一部分,我试图在我的项目上启用SSL,但是我发现的所有事情都涉及更新Visual Studio的项目属性"对话框中的设置,该设置对我来说是无法通过Mac上的Visual Studio Code获得的.我尝试过手动更新launchSettings.json中的值,但是我没有任何运气.

As part of the process I am trying to enable SSL on my project but everything I have found involves updating a setting in the Project Properties dialog in Visual Studio, which is unavailable to me through Visual Studio Code on my Mac. I've tried updating the values in launchSettings.json manually, but I haven't had any luck.

如何在Visual Studio Code中更新launchSettings.json(或其他项目文件)以在调试时启用SSL?

How do I update launchSettings.json (or other project files) in Visual Studio Code to enable SSL while debugging?

推荐答案

如果不想仅为了在VS Code中进行调试而更改Program.cs文件,还可以在launch.json中配置url.您需要在env属性中指定网址.正如xneg所说,您需要设置一个自签名证书才能做到这一点.

If you don't want to change your Program.cs file just for debugging in VS Code, you can also configure the urls in your launch.json. You need to specify the urls in the env property. As xneg said you'll need to set up a self-signed cert to do this.

您可以配置http网址和https(SSL)网址

You can configure the http url and the https (SSL) url

"configurations":[ { ... "env": { "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_URLS": "localhost:5002;localhost:5003" }, ... }

文档对于Kestrel 有助于解决这一问题.

The documentation for Kestrel was helpful in figuring this out.

更多推荐

在调试中为SSL配置launchSettings.json

本文发布于:2023-11-09 09:09:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571992.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中为   SSL   json   launchSettings

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!