Build Microsoft.AspNet.Server.Kestrel.Https for dotnet5.4
This commit is contained in:
parent
bdbd9ae7a6
commit
55f6f21d5a
|
|
@ -2,18 +2,15 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Features;
|
using Microsoft.AspNet.Http.Features;
|
||||||
using Microsoft.AspNet.Server.Kestrel;
|
using Microsoft.AspNet.Server.Kestrel;
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
#if DNX451
|
|
||||||
using System.IO;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using Microsoft.AspNet.Server.Kestrel.Https;
|
using Microsoft.AspNet.Server.Kestrel.Https;
|
||||||
#endif
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace SampleApp
|
namespace SampleApp
|
||||||
{
|
{
|
||||||
|
|
@ -29,7 +26,6 @@ namespace SampleApp
|
||||||
|
|
||||||
loggerFactory.AddConsole(LogLevel.Debug);
|
loggerFactory.AddConsole(LogLevel.Debug);
|
||||||
|
|
||||||
#if DNX451
|
|
||||||
var testCertPath = Path.Combine(
|
var testCertPath = Path.Combine(
|
||||||
env.ApplicationBasePath,
|
env.ApplicationBasePath,
|
||||||
@"../../test/Microsoft.AspNet.Server.KestrelTests/TestResources/testCert.pfx");
|
@"../../test/Microsoft.AspNet.Server.KestrelTests/TestResources/testCert.pfx");
|
||||||
|
|
@ -42,7 +38,6 @@ namespace SampleApp
|
||||||
{
|
{
|
||||||
Console.WriteLine("Could not find certificate at '{0}'. HTTPS is not enabled.", testCertPath);
|
Console.WriteLine("Could not find certificate at '{0}'. HTTPS is not enabled.", testCertPath);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
app.Run(async context =>
|
app.Run(async context =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
|
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
|
||||||
|
"Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-*",
|
||||||
"Microsoft.Extensions.Logging.Console": "1.0.0-*"
|
"Microsoft.Extensions.Logging.Console": "1.0.0-*"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnx451": {
|
"dnx451": {
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-*"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"dnxcore50": {
|
"dnxcore50": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,11 @@
|
||||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
|
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": { }
|
"net451": { },
|
||||||
|
"dotnet5.4": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Net.Security": "4.0.0-beta-*"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
#if DNX451
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
@ -47,7 +47,13 @@ namespace Microsoft.AspNet.Server.KestrelTests
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#if DNX451
|
||||||
|
var handler = new HttpClientHandler();
|
||||||
ServicePointManager.ServerCertificateValidationCallback += validationCallback;
|
ServicePointManager.ServerCertificateValidationCallback += validationCallback;
|
||||||
|
#else
|
||||||
|
var handler = new WinHttpHandler();
|
||||||
|
handler.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
|
||||||
|
#endif
|
||||||
|
|
||||||
var sereverAddress = "https://localhost:54321/";
|
var sereverAddress = "https://localhost:54321/";
|
||||||
var serviceContext = new TestServiceContext()
|
var serviceContext = new TestServiceContext()
|
||||||
|
|
@ -59,7 +65,7 @@ namespace Microsoft.AspNet.Server.KestrelTests
|
||||||
|
|
||||||
using (var server = new TestServer(App, serviceContext, sereverAddress))
|
using (var server = new TestServer(App, serviceContext, sereverAddress))
|
||||||
{
|
{
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient(handler))
|
||||||
{
|
{
|
||||||
var result = await client.PostAsync(sereverAddress, new FormUrlEncodedContent(new[] {
|
var result = await client.PostAsync(sereverAddress, new FormUrlEncodedContent(new[] {
|
||||||
new KeyValuePair<string, string>("content", "Hello World?")
|
new KeyValuePair<string, string>("content", "Hello World?")
|
||||||
|
|
@ -71,9 +77,10 @@ namespace Microsoft.AspNet.Server.KestrelTests
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
#if DNX451
|
||||||
ServicePointManager.ServerCertificateValidationCallback -= validationCallback;
|
ServicePointManager.ServerCertificateValidationCallback -= validationCallback;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,17 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"xunit.runner.aspnet": "2.0.0-aspnet-*",
|
"xunit.runner.aspnet": "2.0.0-aspnet-*",
|
||||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
|
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Testing": "1.0.0-*"
|
"Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-*",
|
||||||
|
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||||
|
"System.Net.Http": "4.0.1-beta-*"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnx451": {
|
"dnx451": { },
|
||||||
"dependencies": {
|
|
||||||
"System.Net.Http": "4.0.1-beta-*",
|
|
||||||
"Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dnxcore50": {
|
"dnxcore50": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Diagnostics.TraceSource": "4.0.0-beta-*",
|
"System.Diagnostics.TraceSource": "4.0.0-beta-*",
|
||||||
"System.IO": "4.0.11-beta-*",
|
"System.IO": "4.0.11-beta-*",
|
||||||
|
"System.Net.Http.WinHttpHandler": "4.0.0-beta-*",
|
||||||
"System.Net.Sockets": "4.1.0-beta-*",
|
"System.Net.Sockets": "4.1.0-beta-*",
|
||||||
"System.Runtime.Handles": "4.0.1-beta-*"
|
"System.Runtime.Handles": "4.0.1-beta-*"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue