dotnet publish-iis不起作用

Vah*_*iri 10 iis publish asp.net-core

我有一个ASP.NET Core RC2项目,我正在尝试将它发布到IIS并且命令dotnet publish-iisALWAYS给出:

Asp.Net Core IIS Publisher
Usage: dotnet publish-iis [arguments] [options]
Arguments:
  <PROJECT>  The path to the project (project folder or project.json) being published. If empty the current directory is used.
Options:
  -h|--help                   Show help information
  --publish-folder|-p         The path to the publish output folder
  -f|--framework <FRAMEWORK>  Target framework of application being published
Run Code Online (Sandbox Code Playgroud)

有没有一个如何运作的例子?如何传递参数?它永远不会......

Paw*_*wel 9

--publish-folder--framework参数是必需的.如果您不提供这些参数,该工具将显示用法.

说过实际上并不期望自己运行这个工具.publish-iis的作用是仅调整已发布应用程序的web.config文件(或者如果不存在则创建新的web.config),以便IIS/IISExpress可以找到要启动的应用程序.换句话说,你必须首先发布你的应用程序然后发布 - 我只是按摩它一点点.因此,预期的用法是配置,以便它作为postpublish脚本运行:

"scripts": {
  "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
Run Code Online (Sandbox Code Playgroud)

publish-iis在本文中详细介绍了使用IIS运行Asp.NET核心应用程序的工具

  • 这是预期的(https://github.com/aspnet/Announcements/issues/173).web.config文件的默认位置现在是您的批准而不是wwwroot.另外,为什么有2个web.config文件会有用? (2认同)

And*_*rei 6

对于ASP.NET Core 1.1.project.json中的关键部分是:

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
  },

  "scripts": {
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
  }
Run Code Online (Sandbox Code Playgroud)

对我来说很棒!