diff --git a/.vsts-pipelines/templates/build-steps.yml b/.vsts-pipelines/templates/build-steps.yml index 33d1e65180..949093b338 100644 --- a/.vsts-pipelines/templates/build-steps.yml +++ b/.vsts-pipelines/templates/build-steps.yml @@ -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: diff --git a/test/IISExpress.FunctionalTests/OutOfProcess/HttpsTest.cs b/test/IISExpress.FunctionalTests/OutOfProcess/HttpsTest.cs index 4f0c93b400..ff9996c851 100644 --- a/test/IISExpress.FunctionalTests/OutOfProcess/HttpsTest.cs +++ b/test/IISExpress.FunctionalTests/OutOfProcess/HttpsTest.cs @@ -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) diff --git a/tools/UpdateIISExpressCertificate.ps1 b/tools/UpdateIISExpressCertificate.ps1 new file mode 100644 index 0000000000..9034cf8f75 --- /dev/null +++ b/tools/UpdateIISExpressCertificate.ps1 @@ -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; \ No newline at end of file