Fix HTTPS certs on VSTS (#1123)
This commit is contained in:
parent
652c529f8f
commit
d99d2d881c
|
|
@ -3,12 +3,8 @@ phases:
|
|||
parameters:
|
||||
agentOs: Windows
|
||||
beforeBuild:
|
||||
- powershell: "git submodule update --init"
|
||||
displayName: Update submodules
|
||||
- powershell: "& ./tools/update_schema.ps1"
|
||||
displayName: Update ANCM schema
|
||||
- powershell: Restart-Service w3svc
|
||||
displayName: Restart IIS
|
||||
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; Restart-Service w3svc"
|
||||
displayName: Prepare repo
|
||||
|
||||
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
// So these tests always have to use ports in this range, and we can't rely on OS-allocated ports without a whole lot of ceremony around
|
||||
// creating self-signed certificates and registering SSL bindings with HTTP.sys
|
||||
// Test specific to IISExpress
|
||||
[SkipInVSTS]
|
||||
public class HttpsTest : IISFunctionalTestBase
|
||||
{
|
||||
public HttpsTest(ITestOutputHelper output) : base(output)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
$cert = New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(5)
|
||||
$thumb = $cert.GetCertHashString()
|
||||
|
||||
$Store = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store -ArgumentList 'root', 'LocalMachine'
|
||||
$Store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
|
||||
$Store.Add($cert)
|
||||
$Store.Close()
|
||||
|
||||
$tempFile = [System.IO.Path]::GetTempFileName();
|
||||
$content = "";
|
||||
|
||||
for ($i=44300; $i -le 44399; $i++) {
|
||||
$content += "http delete sslcert ipport=0.0.0.0:$i`n";
|
||||
$content += "http add sslcert ipport=0.0.0.0:$i certhash=$thumb appid=`{214124cd-d05b-4309-9af9-9caa44b2b74a`}`n";
|
||||
}
|
||||
|
||||
[IO.File]::WriteAllLines($tempFile, $content)
|
||||
|
||||
netsh -f $tempFile
|
||||
Remove-Item $tempFile;
|
||||
Loading…
Reference in New Issue