Enable SSL in Visual Studio

前端 未结 3 843
长发绾君心
长发绾君心 2020-12-01 11:30

I have enabled SSL in Visual Studio as shown below:

I have also set the below:

When I access the website via IE (via Visual Studio debuggin

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 11:46

    @MattW I am using Mac and was facing this issue. I am using Visual Studio 2019 for Mac on macOS Catalina. I opened the "Project Options" for my project and changed "http" to "https" in "App URL" under Default Run Configuration for ASP.NET Core

    Screenshot: Project Options in VS 2019 for mac

    I already had a self-signed certificate for localhost, so Visual Studio gave me a message box asking to use that Development certificate from Keychain. It asked my password and used the certificate. The application worked without any issue on "https"

    Screenshot: Development certificate found message

    In case you do not have the development certificate you can generate one, using following command in your Mac:

    dotnet dev-certs https --clean
    dotnet dev-certs https --trust
    

    Read more at https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-3.1&tabs=netcore-cli

提交回复
热议问题