IIS 部署antdesign

IIS 【URL重寫】入站規則

參考博客:https://www.cnblogs.com/jsonzheng/articles/6606143.html

安裝ARR

下載安裝ARR(Application Request Routing),可通過【Web平臺安裝程序】,安裝成功後會多出 【Application Request Routing Cache】和【URL重寫】圖標,如下圖:

技術分享圖片

本文解決的主要問題

將對http://192.168.31.113:8101/api/xxx的請求轉發至http://192.168.31.110:2893/Web/WebService/xxx

匹配URL規則

^(.*?)/?api/(.*)$

技術分享圖片

條件規則

{HTTP_HOST}

^192.168.31.113:8101$

技術分享圖片

操作規則

http://192.168.31.110:2893/Web/WebService/{R:2}

技術分享圖片

配置完後站點目錄下的web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="test" stopProcessing="true">
                    <match url="^(.*?)/?api/(.*)$" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^192.168.31.113:8101$" />
                    </conditions>
                    <action type="Rewrite" url="http://192.168.31.110:2893/Web/WebService/{R:2}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

將基於ant-design-pro前端框架開發的應用獨立部署在IIS上

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章