简体   繁体   English

.NET 核心 Angular 应用程序在 IIS 上运行 - 不是 IIS Express

[英].NET Core Angular app running on IIS - NOT IIS Express

I have a .NET Core 3.0 Angular app started from the Visual Studio 2019 template.我有一个从 Visual Studio 2019 模板开始的 .NET Core 3.0 Angular 应用程序。 I've done some initial development using IIS Express, but now I'd like to start developing against IIS since that's the web server this app will eventually run on.我已经使用 IIS Express 进行了一些初步开发,但现在我想开始针对 IIS 进行开发,因为这是 web 服务器,此应用程序最终将在其上运行。

I followed the steps here https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-3.0 to set up an IIS profile.我按照此处的步骤https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-3.0设置了 IIS 配置文件.

When I switch to the IIS profile and try to debug the app I get the following error:当我切换到 IIS 配置文件并尝试调试应用程序时,我收到以下错误:

AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm'

I don't have --extract-css in my package.json scripts start and build settings.我的 package.json 脚本启动和构建设置中没有 --extract-css。 I've run npm install inside the ClientApp directory (which found 0 vulnerabilities)我在 ClientApp 目录中运行了 npm install (发现0个漏洞)

How do I set up this app so it runs on IIS?如何设置此应用程序以使其在 IIS 上运行? Do I have a misunderstanding about Angular apps?我对 Angular 应用程序有误解吗? Do they REQUIRE Node as their hosting web server?他们是否需要 Node 作为托管 web 服务器?

you need to install node js on your server.您需要在服务器上安装节点 js。

to deploy the angular site in iis you just need to publish it.要在 iis 中部署 angular 站点,您只需发布它。

1)open an angular application in visual studio. 1) 在 Visual Studio 中打开一个 angular 应用程序。

2)select a project name and click on publish. 2)选择一个项目名称并点击发布。

在此处输入图像描述

3)select the folder option and publish it to the target folder. 3)选择文件夹选项并将其发布到目标文件夹。

在此处输入图像描述

4)after publishing the project open iis and select add a new site and select the published folder path and add site bindings. 4)发布项目后打开 iis 和 select 添加一个新站点和 select 发布的文件夹路径并添加站点绑定。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM