Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1495

Unable to connect to web server 'https' in Visual Studio 2022

$
0
0

I have two projects for the API and UI side of my project.On the UI side, I want to see the change I made with "ctrl + shift + w" on index.cshtml, but I get the error in the screenshot below.

There are errors I receive on the visual studio side and in the microsoft visual studio debug console.Can you help me please?

visual studio

visual studio debug console

Sometimes I get errors like the one below.

visual studio

According to my research, I deleted launchsettings.json in the Properties folder of the UI project and added it again, but it did not work.

When I came to the debug properties of the project, I examined the http, https and IIS sections. Here, in the https section, these addresses were written as https://localhost:7069;http://localhost:5007.

For testing purposes, I opened the IIS side and copied the localhost address there and pasted it into the https section. It worked this time, but I still viewed the swagger page. This was not the page I wanted. Below is the screenshot.

Debug PropertiesContinue from the page

Also, there is no place where I can open the properties of the project and enable or disable SSL. So that option is not possible either. Maybe it's not visible because I'm missing something, I'm not sure.

I want to see the change I made with Browser View.None of http, https or IIS are working during the run phase. I don't know whether it's a problem with localhost or the certificate.


The solutions I tried are:

dotnet dev-certs https --cleandotnet dev-certs https --trust

Uninstall IIS Express via Add Remove ProgramRun command: dotnet dev-certs https --cleanRe-install IIS Express by downloading it from the Microsoft websiteRun the Asp.Net application from Visual StudioVisual studio will prompt for generating a certificate, click yes. In my case, it generated the certificate but failed to add the certificate to the trusted root with an error 'Access Denied'Windows + R and type mmcFile > Add Snap-InSelect Certificates and click addSelect the 'Computer account' option and click finish, then click Ok.Then expand the certificates(Local Computer) > Personal > CertificatesYou will find a local host certificate with the friendly name 'ISS Express Development Certificate'Select the certificate then cut and paste it into Trusted Root Certification Authorities -> Certificates

Below are the screenshots that I would like to show additionally.

Personal Certificate Trusted Root Certification Authorities

Project File ScreenshotProject Files

Code Blocks

RealEstate_Dapper_UI / Properties / launchSettings.json

{"$schema": "http://json.schemastore.org/launchsettings.json","iisSettings": {"windowsAuthentication": false,"anonymousAuthentication": true,"iisExpress": {"applicationUrl": "http://localhost:29591","sslPort": 44379    }  },"profiles": {"http": {"commandName": "Project","dotnetRunMessages": true,"launchBrowser": true,"applicationUrl": "http://localhost:5112","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    },"https": {"commandName": "Project","dotnetRunMessages": true,"launchBrowser": true,"applicationUrl": "https://localhost:7240;http://localhost:5112","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    },"IIS Express": {"commandName": "IISExpress","launchBrowser": true,"environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    }  }}

The index.cshtml I want to run:

@{    ViewData["Title"] = "Index";    Layout = "~/Views/Shared/_MemberLayout.cshtml";}<h1>Index</h1>

UI project/ Program.cs

var builder = WebApplication.CreateBuilder(args);// Add services to the container.builder.Services.AddControllersWithViews();var app = builder.Build();// Configure the HTTP request pipeline.if (!app.Environment.IsDevelopment()){    app.UseExceptionHandler("/Home/Error");    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.    app.UseHsts();}app.UseHttpsRedirection();app.UseStaticFiles();app.UseRouting();app.UseAuthorization();app.MapControllerRoute(    name: "default",    pattern: "{controller=Home}/{action=Index}/{id?}");app.Run();

RealEstate_Dapper_Api / Properties / launchSettings.json

{"$schema": "http://json.schemastore.org/launchsettings.json","iisSettings": {"windowsAuthentication": false,"anonymousAuthentication": true,"iisExpress": {"applicationUrl": "http://localhost:21668","sslPort": 44323    }  },"profiles": {"http": {"commandName": "Project","dotnetRunMessages": true,"launchBrowser": true,"launchUrl": "swagger","applicationUrl": "http://localhost:5027","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    },"https": {"commandName": "Project","dotnetRunMessages": true,"launchBrowser": true,"launchUrl": "swagger","applicationUrl": "https://localhost:7032;http://localhost:5027","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    },"IIS Express": {"commandName": "IISExpress","launchBrowser": true,"launchUrl": "swagger","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    }  }}

Debug Properties Menu Screenshots

  1. https properties
  2. IIS Properties
  3. http properties

Viewing all articles
Browse latest Browse all 1495

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>