简体   繁体   English

使用 Visual Studio 安装程序项目将 ASP .NET 核心服务安装到 IIS

[英]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.

相关问题 Visual Studio安装程序项目扩展-安装服务 - Visual Studio Installer Projects Extension - Install a Service 如何使用 Visual Studio 代码为 .NET Core 的工作人员服务创建安装程序 - How to create an installer for worker service of .NET Core using visual studio code 在Visual Studio Code中调试多个ASP.NET Core项目 - Debug multiple ASP.NET Core projects in Visual Studio Code C# - 在 Microsoft Visual Studio 安装程序项目 2022 中安装 .NET 6.0.7 运行时 - C# - Installing .NET 6.0.7 Runtime in Microsoft Visual Studio Installer Projects 2022 IIS的Visual Studio Team Services asp.net核心版本 - Visual Studio Team Services asp.net core build for IIS 如何使用Visual Studio为.net Windows服务创建安装程序 - How to create an installer for a .net Windows Service using Visual Studio 在asp.net上使用axapta businessconnectornet导致Visual Studio / IIS崩溃 - Visual Studio / IIS Crashing using axapta businessconnectornet on asp.net Visual Studio-独立的Asp.net项目 - Visual studio - Separate asp.net projects 如何使用 Visual Studio 安装程序项目安装 .NET 6 Windows 服务(Worker Service)? - How do you install a .NET 6 Windows Service (Worker Service) using a Visual Studio Installer project? 使用 Visual Studio 安装程序安装后 .NET WPF 运行时错误 - .NET WPF runtime error after installing with Visual Studio Installer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM