gpt4 book ai didi

c# - 错误 - 403 禁止 - Microsoft-Azure-Application-Gateway/v2

转载 作者:行者123 更新时间:2023-12-02 06:58:53 31 4
gpt4 key购买 nike

当我尝试将以下请求发送到 .net core Web api 时,收到错误“403 Forbidden - Microsoft-Azure-Application-Gateway/v2”。我已将 HTML 编码用于 encodeEmailBody 属性。

Web Api 代码:-

[HttpPut("UpdateEmail")]
[Produces("application/json")]
public async Task<IActionResult> UpdateEmailAsync([FromBody] EmailRequest emailRequest)
{
var result = await _businessService.UpdateEmailAsync(emailRequest);
return Ok(result);
}

请求类(class)

public class EmailRequest
{
public Guid EmailTemplateTypeId { get; set; }
public string EncodeEmailSubject { get; set; }
public string EncodeEmailBody { get; set; }
public Guid CountryId { get; set; }
}

请求

{
"emailTemplateTypeId": "4C4B989B-769B-4999-8109-5A51199C09A8",
"encodeEmailSubject": "test",
"encodeEmailBody": "&lt;p&gt;The retention file MXMT generation for the &quot;&lt;&lt;EngagementName&gt;&gt;&quot; did not complete successfully.&lt;p&gt;&lt;p&gt;Please contact your local country helpdesk support function.&lt;p&gt;&lt;hr&gt;&lt;i&gt;This is an automatically generated email. Please do not respond to this email. The mailbox is not b",
"countryId": "47E37625-ECC5-4F68-ACA6-61432787390D"
}

错误:-

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>Microsoft-Azure-Application-Gateway/v2</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

注意:当我在本地调用此 API 时,它工作正常,但在服务结构节点上不起作用。

任何帮助都将受到重视。

最佳答案

请求正被位于服务前面的 Azure 应用程序网关停止。

https://learn.microsoft.com/en-us/azure/application-gateway/overview

Azure 应用程序网关包含防火墙 (WAF)

问题可能是 WAF 将您的请求标记为恶意请求。您需要首先检查防火墙上的日志以了解其被阻止的原因,然后禁用阻止该请求的规则,或创建异常(exception)规则以允许该特定 URL 通过。

关于c# - 错误 - 403 禁止 - Microsoft-Azure-Application-Gateway/v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66821199/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com