一: 安装Application Request Routing
二; 设置 Application Request Routing:
三: 建立站点代理:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Rewrite rule1 for /home"> <match url=".*" /> <conditions> </conditions> <action type="Rewrite" url="http://localhost:8088/WeatherForecast" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
80 端口代理到8080
再建一个代理,8080 代理到 http://localhost:5000/WeatherForecast
启动调试一个 .net core webapi 站点
浏览器 访问: http://localhost/proxy/xxxx
会访问到:http://localhost:5000/WeatherForecast
打断点到这个Action: 可以看到请求头上的信息