Solved: Site Can't Provide a Secure Connection in Visual Studio

Coding With Brett
Coding With Brett
1 هزار بار بازدید - 6 ماه پیش - Here's how to solve the
Here's how to solve the error message "Site Can't Provide a Secure Connection" when you attempt to connect to your ASP.NET or .NET Core web application in Visual Studio. It's most likely to occur with legacy web forms or MVC projects and solutions.

00:00 - Introduction
00:18 - IIS Express SSL Ports
01:30 - Manually Changing SSL Port
02:55 - Project Properties Tab
03:50 - .NET Core Projects

This issue appears to affect Visual Studio 2019 and probably all subsequent versions. It definitely affects Visual Studio 2022.

The issue is caused by a number of reasons. The most common one I've encountered is when the developer is trying to run a site using SSL but the port number used by IIS Express is less than 44300. If you're using IIS Express with the default self-signed SSL certificate, this certificate is pre-configured to work with any SSL ports in the range of 44300 to 44399.

Changing the SSL port can be a hassle in Visual Studio. If you can't change it then look for a .vs folder in your Solution. In a config subfolder there should be a file called applicationhost.config. You can manually change the SSL port in this file. Alternatively just delete it and then restart Visual Studio. The file will be recreated if it doesn't exist.

An alternative solution is to run Visual Studio as an Administrator. However this is no longer recommended due to the security implications.

For .NET Core web applications the SSL port can be changed by editing it in the launchSettings.json file that is located in the Project's Properties folder.

Hopefully this video solves any issues you have with the annoying "Site Can't Provide a Secure Connection" issue. If you find any other solutions then leave a comment below.
6 ماه پیش در تاریخ 1402/10/30 منتشر شده است.
1,055 بـار بازدید شده
... بیشتر