【问题标题】:Build output of MVC6 app. How does it works now?构建 MVC6 应用程序的输出。它现在如何运作?
【发布时间】:2015-11-22 23:09:31
【问题描述】:

我正在检查默认的 MVC 6 应用程序并在本地文件系统上发布构建。这是我检查 Compile source files to nuget pacakges

时的样子

我可以看到 3 个主要文件夹:approotlogswwwroot

approot 内部:

我可以看到我的 WebApplication1 现在是一个 nuget 包。

  1. approot>Packages>WebApplicaton1>1.0.0>app 中的 ef 文件是什么?

  2. ef 文件和 2 个 web 文件也在 approot 中。它们是什么?

在 wwwroot 里面:里面有我所有的静态资源,比如 css 和 js。

当我们在 IIS 或 azure 中部署应用程序时,这一切是如何实现的?

【问题讨论】:

    标签: asp.net-core asp.net-core-mvc


    【解决方案1】:

    已发布输出中的efweb 文件对应于您在project.json 文件中定义的efweb commands。您可以在 project.json 文件中定义更多命令,所有命令都会显示在这里。

    beta-8 版本开始,ASP.NET 5 在 IIS 中使用一个名为 HttpPlatformHandler 的模块,它将 http 请求转发到外部进程……在我们的例子中,它是 dnx.exe 进程。例如,您可以查看wwwroot 下的以下web.config 文件,该文件显示了模块注册以及执行外部进程的路径...正如您在此处看到的web.cmd 正在使用。

    <configuration>
      <system.webServer>
        <handlers>
          <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        <httpPlatform processPath="%home%\site\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout.log"></httpPlatform>
      </system.webServer>
    </configuration>
    

    这种设计也适用于非 Windows 场景...例如,您也可以将您的应用与 nginx 反向代理一起使用

    更多更深入的细节可以在以下链接中找到:

    Change to IIS hosting model

    【讨论】:

      猜你喜欢
      • 2020-12-10
      • 1970-01-01
      • 1970-01-01
      • 2021-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多