Skip to content

Instantly share code, notes, and snippets.

@herecydev
Last active November 23, 2015 21:37
Show Gist options
  • Save herecydev/a45ae4bdb8aebc1cef5a to your computer and use it in GitHub Desktop.
Save herecydev/a45ae4bdb8aebc1cef5a to your computer and use it in GitHub Desktop.
Kestrel https
{
"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"
]
}
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();
}
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