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

发布于 2025-01-26 14:36:09 字数 520 浏览 5 评论 0原文

我正在将IIS V7.5与Windows Server一起部署Angular + .NET 4.5 FullStack应用程序。

我正在同一站点上使用不同版本的应用程序的多个实例,以进行其他测试!

如下所示,所有站点均部署在带有HTTPS的同一主机上,每个站点都以HTTPS和不同的端口进行前端和后端部署(前端部分和后端部件),如下所示:

“部署架构”

两个月之前:所有实例都被部署为相同的结构但是,将所有http用于所有人,而且什么都没发生(一切正常),

我的问题是,当我更改使用HTTPS的实例时,当然,在更改构建方面以进行适当的链接,我会遇到错误,而Frontend无法与后端进行通信! 这是与IIS和HTTPS以及多个实例有关的问题吗?

Am using IIS V7.5 with windows server for deploying Angular + .Net 4.5 fullStack application.

Am using multiple instances at same site with different versions of application in order to make additional test !

all sites are deployed on same host with https and different ports each for frontend and backend (frontend part and backend part are deployed seperately ) as shown below :

Architecture of deployement

Before two months : all instance were deployed all as same structure but using http for all , and nothing happened ( everthing is working fine )

my problem is , when i changed instances to use https , of course with changing build for appropriate link , i get errors and frontend can't communicate with backend anymore !
is it a problem related to IIS and https and multiple instances ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒岛晴空 2025-02-02 14:36:09

作为解决这个问题的解决方案,许多开发者将来可以面对它:
我已更改为File 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>

注意:对于IIS版本7.xx和6.xx和Windows Server 2012 R2,此错误已被确认。

As a solution for this issue , as so many developpers can face it in the future :
I have changed to file Web.config (XML File ) inside the folder dist of the build of the frontend part before deplyoing it on 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>

Note : For IIS version 7.x.x and 6.x.x and windows Server 2012 R2 This error is confirmed .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文