Jor*_*ork 4 iis-8 asp.net-core
我无法dotnet publish-iis正常运行.
要发布我正在使用的项目:
dotnet publish ./src/RetailGuardian.Web/ -o ./code_drop/RetailGuardian.Web --runtime dnet452
Run Code Online (Sandbox Code Playgroud)
我在我的帖子中设置了一个postpublish脚本project.json:
"scripts": {
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
Run Code Online (Sandbox Code Playgroud)
初始发布工作正常,并按预期将代码放在code_drop目录中(这是我以前在RC1中部署的,它工作正常).但是,在尝试查找web.config时,publish-iis似乎不使用输出路径.这是运行时的输出:
Configuring the following project for use with IIS: './code_drop/RetailGuardian.Web'
No web.config found. Creating './code_drop/RetailGuardian.Web\web.config'
Could not find a part of the path 'G:\Projects\retailguardian\src\RetailGuardian.Web\code_drop\RetailGuardian.Web\web.config'.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'G:\Projects\retailguardian\src\RetailGuardian.Web\code_drop\RetailGuardian.Web\web.config'.
at System.IO.Win32FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
at System.IO.Win32FileSystem.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, Int32
bufferSize, FileOptions options, FileStream parent)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at Microsoft.AspNetCore.Server.IISIntegration.Tools.PublishIISCommand.Run()
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.<>c__DisplayClass0_0.<Main>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
publish: Published to ./code_drop/RetailGuardian.Web
Published 1/1 projects successfully
Run Code Online (Sandbox Code Playgroud)
所以它试图使用G:\Projects\retailguardian\src\RetailGuardian.Web\code_drop\RetailGuardian.Web\web.config哪个是源目录,而不是G:\Projects\retailguardian\code_drop\RetailGuardian.Web\web.config发布输出的位置.
(奇怪的是它也报告发布成功,即使发布后失败)
这似乎是一个错误,其中dotnet命令解析相对路径,然后更改当前目录以调用尝试再次解析路径的工具,但现在它相对于不同的文件夹解析它,因此最终路径不同.感谢您报告此事 - 我在cli repo中打开了一个问题:https://github.com/dotnet/cli/issues/3528
可能的解决方法:
| 归档时间: |
|
| 查看次数: |
1652 次 |
| 最近记录: |