连接到本地响应时间问题的 Azure 应用服务

Azure App service connecting to on prem response time issues

嗨,我正在尝试通过 HCM 从 Azure 应用服务连接到 onprem 服务,每个非活动期后的第一次调用需要 16 秒,之后速度非常快,感觉就像一旦连接建立应用服务, HCM(混合连接管理器)和 onprem 响应速度更快,但一旦处于非活动状态,连接可能会断开?不确定这在内部是如何工作的。我的应用服务是 linux。有人遇到过类似的问题吗?

减少响应时间:

第 1 步: 在部署到 Azure 之前尝试预编译代码。如果您使用 visual studio 通过执行右键单击发布来部署项目,然后按照下面的屏幕截图

同时检查 Precompilation Options 预编译网站

并检查部署 precompiled website 如何部署网站。

第 2 步:

在web.config

中查看.NET Framework的重写规则
<system.webServer>  
<rewrite>  
<rules>  
<rule name="Redirect to https"> 
<match url="(.*)"/>  
<conditions>  
<add input="{HTTPS}" pattern="Off"/>  
</conditions>  
<action type="Redirect" url="[https://{HTTP_HOST}/{R:1](https://medium.com/tryce-technologies/%7BHTTP_HOST%7D/%7BR:1)}"/>  
</rule>  
</rules>  
</rewrite>  
</system.webServer> 

由于这条规则,“永远在线”请求将停止工作

尝试按以下方式编写规则

 <system.webServer>  
<rewrite>  
<rules>  
**<rule name="No HTTPS for user agent AlwaysOn and Root of site" stopProcessing="true">  
<match url="^$"/>  
<conditions>  
<add input="{HTTP_USER_AGENT}" pattern="^AlwaysOn$" />  
</conditions>  
<action type="None" />  
</rule>**  
<rule name="Redirect to https">  
<match url="(.*)"/>  
<conditions>  
<add input="{HTTPS}" pattern="Off"/>  
</conditions>  
<action type="Redirect" url="[https://{HTTP_HOST}/{R:1](https://medium.com/tryce-technologies/%7BHTTP_HOST%7D/%7BR:1)}"/>  
</rule>  
</rules>  
</rewrite>  
</system.webServer>

更多问题可以refer

如果问题仍然存在,请发送 HAR Traces 以找出确切的问题。

问题是服务器证书有一个 属性 证书吊销列表 CRL,它指向另一个无法解析的 URL,它尝试连接到它但无提示地失败了(这花了一段时间)。为了解决这个问题,我将 CRL Url 添加到 HCM 并解决了延迟问题。