angular - AZURE 应用服务 web.config 中的多个处理程序
问题描述
Azure 应用服务的 web.config 中是否可以有多个 in 处理程序?
我有一个 .Net Core API 和一个 Angular Universal (Node.js) SPA 前端。如果可能,我想将它们保留在同一个应用服务上。为此,我认为我需要处理我的 web.config 文件。是否可以让所有 /api 请求都转到 .Net Core API,而对前端的请求由 Node / Angular Universal 处理?
这就是我现在在一个应用服务中为 .Net Core API 所拥有的:
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
这就是我在另一个应用服务中的 Angular Universal Node.js 前端所拥有的:
<handlers>
<add name="iisnode" path="server/main.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^main.js\/debug[\/]?" />
</rule>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
我想将这两者结合起来,以便所有 API 请求 (/api) 都被路由到 .Net Core API,所有前端请求 (/) 都转到 Node 处理程序并重写以使用 Index.html。
如果可能的话,谁能帮我解决这个问题?
解决方案
推荐阅读
- java - 使用 AffineTransform Java 旋转图像时出现偏移错误
- django - 在 Django 中运行迁移命令时出现编程错误
- php - 使用 PHP/GD 生成带有“镀金”文字效果的图像
- java - 使用 FileProvider 尝试通过隐式 Intent 共享 MP3 时出现 FileNotFoundException
- asp.net - 自定义模型绑定器未针对 ASP.NET Core 2 中的单个属性触发
- java - LocalSessionFactoryBean packagesToScan 不能使用多个值
- python-3.x - 使用 numpy.concatenate 时出现错误
- mysql - MySQL INSERT 多行 ON DUPLICATE KEY UPDATE ... WHERE EXISTS(子查询)
- angular - FormArray 将值返回为数组数组而不是 Angular 中的对象数组
- c# - 如何使继承类的构造函数在类的构造函数之后运行