如何自托管ASP.NET 5 MVC6应用程序 [英] How to self-host ASP.NET 5 MVC6 application

查看:93
本文介绍了如何自托管ASP.NET 5 MVC6应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚开始学习ASP.NET 5/MVC 6 我很好奇自己在IIS外部托管这样的应用程序-作为Windows服务. 我应该像使用OWIN/Katana应用程序那样使用TopShelf,还是ASP.NET 5通过NuGet软件包提供一些内置的自托管(作为服务)选项?

Just started learning ASP.NET 5 / MVC 6 I'm curious about self-hosting such an app outside of IIS - as a Windows service. Should I be using TopShelf for that, like it was the case with OWIN/Katana apps, or does ASP.NET 5 provide some built-in self-hosting (as a service) options via a NuGet package?

推荐答案

您可以使用 Kestrel 库进行自我托管. 在project.json文件中将依赖项添加到库中:

You can use the Kestrel library for self-hosting. Add dependency to the library in the project.json file:

"dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    // Dependencies deleted for brevity.
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
}

然后为Kestrel设置以下命令:

Then scecify this command for Kestrel:

"commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
}

您可以通过命令行从MVC项目的文件夹中启动它:

You can start it by command line from the folder with your MVC project:

dnx web

请通知dnvm必须先运行.

这篇关于如何自托管ASP.NET 5 MVC6应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆