HTTPS 部署的 IIS 7.x 服务器错误

IIS 7.x server error with HTTPS deployement

我正在使用带有 windows 服务器的 IIS V7.5 来部署 Angular + .Net 4.5 fullStack 应用程序。

我在同一站点使用不同版本应用程序的多个实例,以便进行额外测试!

所有站点都部署在同一台主机上,前端和后端都使用 https 和不同的端口(前端部分和后端部分分别部署),如下所示:

两个月前:所有实例都以相同的结构部署,但都使用 http,没有任何反应(一切正常)

我的问题是,当我将实例更改为使用 https 时,当然要为适当的 link 更改构建,我会遇到错误并且前端无法再与后端通信! 是IIS和https以及多实例相关的问题吗?

作为此问题的解决方案,因为许多开发人员将来可能会遇到它: 在将其部署到 iis 之前,我已更改为前端部分构建的文件夹 dist 中的文件 Web.config(XML 文件):

    <?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>

注意:对于 IIS 版本 7.x.x 和 6.x.x 和 windows Server 2012 R2 此错误已确认。