我正在使用IISV7.5与windows服务器一起部署.Net + fullStack 4.5应用程序。
我正在使用多个实例在同一个网站上与不同版本的应用程序,以作出额外的测试!
所有站点都部署在同一个主机上,每个端口分别用于前端和后端(前端部分和后端部分分别部署),如下所示:

两个月前:所有实例都以相同的结构部署,但使用http for all,什么都没有发生(一切正常)
我的问题是,当我更改实例以使用https时,当然,通过更改构建以获得适当的链接,我会得到错误,前端无法再与后端进行通信了!这是一个与IIS和https以及多个实例相关的问题吗?
发布于 2022-05-11 14:12:55
作为解决此问题的一个解决方案,许多开发人员将来可能会面临这样的问题:我已更改为在构建前端部分的文件夹dist中文件Web.config (XML ),然后将其放在iis上:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!--START REDIRECT TO HTTPS-->
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
<!--END REDIRECT TO HTTPS-->
<!--START REDIRECT TO ROOT-->
<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" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(token)" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(userguide.cshtml)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
<!--END REDIRECT TO ROOT-->
</rules>
</rewrite>
</system.webServer>
</configuration>
注意:对于IIS7.x.x和6.x.x以及windows 2012 R2版本,此错误将得到确认。
https://stackoverflow.com/questions/72130338
复制相似问题