This project is mostly discontinued. Please look at Kestrel. I will have to resurect this one only in case Kestrel will not be stable and usable soon enough. If you don't agree with this speak yourself up in issues.
Fast and scalable Owin Web Server in pure .Net 4.5 (it does not use HttpListener)
Additional library for Owin Acme client with sample Nowin server updating Certificate completely automatically, which also redirect all http to https.
Current status is usable for testing, not for production, nobody did any security review, you have been warned. On Windows speed is better than NodeJs and in some cases even better than HttpListener.
Features it supports:
Sample: (uses Microsoft.Owin.Hosting nuget)
static class Program
{
static void Main(string[] args)
{
var options = new StartOptions
{
ServerFactory = "Nowin",
Port = 8080
};
using (WebApp.Start<Startup>(options))
{
Console.WriteLine("Running a http server on port 8080");
Console.ReadKey();
}
}
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Use(context =>
{
if (context.Request.Path == "/")
{
context.Response.ContentType = "text/plain";
return context.Response.WriteAsync("Hello World!");
}
context.Response.StatusCode = 404;
return Task.Delay(0);
});
}
}
Https sample using builder:
var builder = ServerBuilder.New().SetPort(8888).SetOwinApp(SomeOwinApp);
builder.SetCertificate(new X509Certificate2("certificate.pfx", "password"));
using (builder.Start())
{
Console.WriteLine("Listening on port 8888. Enter to exit.");
Console.ReadLine();
}
If running on OSX/Linux and MonoDevelop/Xamarin, to use the above sample please select external console in your project options by going to Options / Run / General / Run on external console
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。