-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPS Error using IIS Express #26437
Comments
@saha1506 thanks for contacting us. Can you follow the same steps indicated in #16892 to gather the info that would help us troubleshoot this issue? (Check the certificate, check the binding, export the certificate so that we can see if its valid and so on). @shirhatti @blowdart this is IIS Express related. |
@javiercn 1. Project properties:2. Certconfig.txtWhen I open netsh http show sslcert > certconfig.txt I have this: 3. certificate exportlocalhost certificate export (I will change certificate after issue will be close) |
@saha1506 thanks for the additional details @shirhatti @blowdart can you take it from here? (likely @shirhatti) |
I listed the cert info with openssl
Nothing strikes me as wrong here, so I'll leave this for you folks if it helps. |
Thanks! About CertificateMessage from #16892 I use guide to remove all localhost certificates (if there are duplicates), and create new one. But after Security warning "Do you want to install certificate" I had no result. Like in #16892 Guide to remove all local host certificates from MMC: |
@saha1506 It's unclear from your previous comment if your issue has been resolved? |
No, it's not. Still ERR_CONNECTION_RESET |
Thanks for contacting us. |
I will try reinstalling Windows. Previously, ASP projects worked fine for me, but after updating Visual Studio something happened, so I think |
Can confirm this as well, on top of that running
|
|
@saha1506 Assuming you're using IIS Express and seeing this error you can try re-generating your IIS Express development certificate Start-Transcript -Path "$($MyInvocation.MyCommand.Path).log"
try {
Write-Host "Creating cert resources"
$ekuOidCollection = [System.Security.Cryptography.OidCollection]::new();
$ekuOidCollection.Add([System.Security.Cryptography.Oid]::new("1.3.6.1.5.5.7.3.1","Server Authentication")) | Out-Null
$sanBuilder = [System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder]::new();
$sanBuilder.AddDnsName("localhost") | Out-Null
Write-Host "Creating cert extensions"
$certificateExtensions = @(
# Subject Alternative Name
$sanBuilder.Build($true),
# ASP.NET Core OID
[System.Security.Cryptography.X509Certificates.X509Extension]::new(
"1.3.6.1.4.1.311.84.1.1",
[System.Text.Encoding]::ASCII.GetBytes("IIS Express Development Certificate"),
$false),
# KeyUsage
[System.Security.Cryptography.X509Certificates.X509KeyUsageExtension]::new(
[System.Security.Cryptography.X509Certificates.X509KeyUsageFlags]::KeyEncipherment,
$true),
# Enhanced key usage
[System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension]::new(
$ekuOidCollection,
$true),
# Basic constraints
[System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension]::new($false,$false,0,$true)
)
Write-Host "Creating cert parameters"
$parameters = @{
Subject = "localhost";
KeyAlgorithm = "RSA";
KeyLength = 2048;
CertStoreLocation = "Cert:\LocalMachine\My";
KeyExportPolicy = "Exportable";
NotBefore = Get-Date;
NotAfter = (Get-Date).AddYears(1);
HashAlgorithm = "SHA256";
Extension = $certificateExtensions;
SuppressOid = @("2.5.29.14");
FriendlyName = "IIS Express Development Certificate"
}
Write-Host "Creating cert"
$cert = New-SelfSignedCertificate @parameters
$rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store -ArgumentList Root, LocalMachine
$rootStore.Open("MaxAllowed")
$rootStore.Add($cert)
$rootStore.Close()
Write-Host "Creating port bindings"
# Add an Http.Sys binding for port 44300-44399
$command = 'netsh'
for ($i=44300; $i -le 44399; $i++) {
$optionsDelete = @('http', 'delete', 'sslcert', "ipport=0.0.0.0:$i")
$optionsAdd = @('http', 'add', 'sslcert', "ipport=0.0.0.0:$i", "certhash=$($cert.Thumbprint)", 'appid={214124cd-d05b-4309-9af9-9caa44b2b74a}')
Write-Host "Running $command $optionsDelete"
& $command $optionsDelete
Write-Host "Running $command $optionsAdd"
& $command $optionsAdd
}
}
catch {
Write-Error $_.Exception.Message
}
finally {
Stop-Transcript
} |
@shirhatti thanks! Your solution works! |
@shirhatti Thank you very much. |
Same issue: #16892
@blowdart
I found that in 2019 a developer pointed out this problem, but it still hasn't solved.
Problem
I think IIS Express isn't serving up HTTPS
When HTTPS is enabled, the project is not working in all browsers. When it is disabled, everything works fine.
ERROR in Chrome v80+ "ERR_CONNECTION_RESET"
FireFox ERROR: PR_CONNECT_RESET_ERROR
I have tried reinstalled Visual Studio, rewriting local host certificates, restoring and reinstalling IIS Express 10. Same issue over and over again
When starting HTTPS, the browser gives the error mentioned above.
HTTPS port is specified: https: // localhost: 44341
Yes, after rewriting SSL certificate, VS ask for confirm new certificate. But after that browser show the same issue. Antivirus is turned off...
Further technical details
Visual Studio 2019 version 16.0
The text was updated successfully, but these errors were encountered: