[英]Installing ASP .NET Core service to IIS using Visual Studio Installer Projects
I have a ASP .NET Core 3.1 application which is hosted as a windows service using IHostBuilder.UseWindowsService
call.我有一个 ASP .NET Core 3.1 应用程序,它使用
IHostBuilder.UseWindowsService
调用作为 windows 服务托管。 I am preparing a setup project using Visual Studio Installer Projects Extensions.我正在使用 Visual Studio Installer Projects Extensions 准备安装项目。 The project is created as Web Setup project type so that the installer dialog already presents to the user selection of web page and application pool on IIS.
该项目创建为 Web 安装项目类型,因此安装程序对话框已经呈现给用户选择 web 页面和 IIS 上的应用程序池。
The problem I'm facing is that the assemblies are successfully installed in given folder on IIS, but the ApplicationService.deps.json
is not installed.我面临的问题是程序集已成功安装在 IIS 的给定文件夹中,但未安装
ApplicationService.deps.json
。 Without this file the application does not start successfully.如果没有此文件,应用程序将无法成功启动。 As far as I have checked the file is created as part of the build in
bin\x64\Release\netcoreapp3.1\
but is apparently not included by the Setup project.据我检查,该文件是作为
bin\x64\Release\netcoreapp3.1\
构建的一部分创建的,但显然不包含在安装项目中。
I've played around also with Setup project's property PublishProfilePath
by specify the profile that I generated when manually trying to publish from Visual Studio to IIS:通过指定手动尝试从 Visual Studio 发布到 IIS 时生成的配置文件,我还使用了安装项目的属性
PublishProfilePath
:
However, this produces even stranger results.然而,这会产生更奇怪的结果。 The application is deployed to the IIS already when I build the Setup project, Then when check the newly created msi.
当我构建安装项目时,应用程序已经部署到 IIS,然后检查新创建的 msi。 it's size is really small and in fact does not install anything (completes successfully though).
它的尺寸非常小,实际上没有安装任何东西(虽然成功完成)。
Any help would be highly appreciated.任何帮助将不胜感激。
I managed to solve the problem, though I'm not sure if that's the optimal solution.我设法解决了这个问题,但我不确定这是否是最佳解决方案。 In the setup project, you can include as part of the output also individual files.
在设置项目中,您可以将单个文件作为 output 的一部分包括在内。 If I add the
ApplicationService.deps.json
it is marked with a relative path in the setup project itself.如果我添加
ApplicationService.deps.json
它在安装项目本身中标有相对路径。 This means that once setup project is being build, the ApplicationService project is anyway built first as it's the primary output of setup project.这意味着一旦安装项目正在构建,ApplicationService 项目无论如何都会首先构建,因为它是安装项目的主要 output。 At that point `ApplicationService.deps.json' is present in the Release folder.
此时“ApplicationService.deps.json”出现在 Release 文件夹中。 Then as msi is being created it's included as part of the output.
然后在创建 msi 时,它作为 output 的一部分包含在内。
It works, but I would prefer that the setup project would include that file automatically.它可以工作,但我希望安装项目自动包含该文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.