iis - 将 ASP.NET 5 MVC 6 应用程序部署到 Linux 和 IIS 7

标签 iis debian asp.net-core-mvc

我有 asp.net 应用程序,出于本文的目的,它只是被默认的 MVC 6 项目取代。我正在尝试决定是否将它部署到我的 linux Debian 8.2 Jessie Server(首选)或 Windows Server 2008 R2 IIS 7。

就 Linux 而言,我已按照以下站点的说明进行操作,但我对如何以及在何处部署站点文件感到困惑。

Installing ASP.NET 5 On Linux

How to Install ASP.Net 5 on Ubuntu Linux

另外我不确定我应该使用 Kestrel 还是 Mono。然后我听到Docker也在被折腾。我只需要知道在 Linux 上托管 MVC 6 应用程序的最佳方式(不一定是最简单的方式)。

就 IIS 7 而言,我已按照此处的视频说明进行操作 ASP.NET5 MVC Deployment to IIS Web Server但是当我尝试查看该站点时出现以下错误:

HTTP 错误 403.14 - 禁止访问 Web 服务器配置为不列出此目录的内容。 最可能的原因:没有为请求的 URL 配置默认文档,并且服务器上没有启用目录浏览。

请帮助我或为我指明正确的方向以解决此问题。

***** 编辑 *****

好的,我已经下定决心要让它正常工作。自从我第一次问这个问题以来,我在几个方面取得了进展。

首先我已经正确安装了 dnx、dnu、dnvm。我能够运行 dnu 恢复以获取我的所有依赖项。我安装了 nginx,它将传入请求定向到我在 project.json 文件中设置的 127.0.0.1:5000

项目.json:

"commands": {
    "web": "Microsoft.AspNet.Server.Kestrel --server Kestrel --server.urls http://localhost:5000",
    "ef": "EntityFramework.Commands"
  },

nginx:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        server_name aspnet.dev www.aspnet.dev;

        location / {
                proxy_set_header        Host $host;
                proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://127.0.0.1:5004;
        }
}

然后我导航到根文件夹和 dnx web,它显示以下内容:

托管环境:生产 现在收听:http://localhost:5000 申请开始。按 Ctrl+C 关闭。

现在因为 nginx 正在将请求定向到带有

的 asp 项目
proxy_pass http://127.0.0.1:5004 

我可以看到正在处理一些请求。

info: Microsoft.AspNet.Hosting.Internal.HostingEngine[1]
      Request starting HTTP/1.0 GET http://***.**.**.***/
info: Microsoft.AspNet.Mvc.Controllers.ControllerActionInvoker[1]
      Executing action method AspNet5.Controllers.HomeController.Index with arguments () - ModelState is Valid'
info: Microsoft.AspNet.Mvc.ViewFeatures.ViewResultExecutor[1]
      Executing ViewResult, running view at path /Views/Home/Index.cshtml.
info: Microsoft.AspNet.Mvc.Infrastructure.MvcRouteHandler[2]
      Executed action AspNet5.Controllers.HomeController.Index in 0.1468ms
info: Microsoft.AspNet.Hosting.Internal.HostingEngine[2]
      Request finished in 0.1849ms 200 text/html; charset=utf-8

但它不会向浏览器提供任何 html。有什么建议吗?

最佳答案

如果有人对我刚刚如何纠正我的问题感兴趣,请参阅这篇文章:Hiccups with Hosting ASP .NET 5 apps on Linux (RC1)

关于iis - 将 ASP.NET 5 MVC 6 应用程序部署到 Linux 和 IIS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35020600/

相关文章:

windows - IIS - 您无权查看此页面错误消息

ruby-on-rails - 无法在 Debian 上启动 Rails Server "sqlite3/sqlite3_native (LoadError)"

ubuntu - pbuilder 创建失败

asp.net-mvc - 如何使用依赖注入(inject)将 UserId/TenantId 传递给存储库构造函数?

没有应用程序池回收的 IIS 7 IP 限制?

powershell - http 的 Set-ItemProperty 删除 IIS 中网站的现有绑定(bind)

ubuntu - 在 Debian Ubuntu 上测试 Crontab

error-handling - 如何判断哪个 Controller 引发了异常

asp.net-core - 用于 DataAnnotations 本地化的单个资源文件

asp.net - webcal URI 方案上的 ics 文件