Last active
November 23, 2015 21:37
-
-
Save herecydev/a45ae4bdb8aebc1cef5a to your computer and use it in GitHub Desktop.
Kestrel https
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "1.0.0-*", | |
"compilationOptions": { | |
"emitEntryPoint": true | |
}, | |
"dependencies": { | |
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", | |
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final", | |
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", | |
"Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-rc1-final", | |
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", | |
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", | |
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", | |
"Microsoft.Extensions.Logging": "1.0.0-rc1-final", | |
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", | |
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final" | |
}, | |
"commands": { | |
"web": "Microsoft.AspNet.Server.Kestrel --server.urls=https://localhost:5001" | |
}, | |
"frameworks": { | |
"dnx451": { } | |
}, | |
"exclude": [ | |
"wwwroot", | |
"node_modules" | |
], | |
"publishExclude": [ | |
"**.user", | |
"**.vspscc" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) | |
{ | |
loggerFactory.AddConsole(Configuration.GetSection("Logging")); | |
loggerFactory.AddDebug(); | |
var certificate = new X509Certificate2("local.pfx", "asd"); | |
app.UseKestrelHttps(certificate); | |
app.UseIISPlatformHandler(); | |
app.UseStaticFiles(); | |
app.UseMvc(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using Microsoft.AspNet.Mvc; | |
namespace WebApplication1.Controllers | |
{ | |
[Route("api/[controller]")] | |
[RequireHttps] | |
public class ValuesController : Controller | |
{ | |
// GET: api/values | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "value1", "value2" }; | |
} | |
//snipped | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment