当我试图将下面的请求发送到.net核心web时,我得到的错误为"403禁止-Microsoft应用程序-网关/v2“。我对encodeEmailBody属性使用了HTML编码。
网络应用程序代码:-
[HttpPut("UpdateEmail")]
[Produces("application/json")]
public async Task<IActionResult> UpdateEmailAsync([FromBody] EmailRequest emailRequest)
{
var result = await _businessService.UpdateEmailAsync(emailRequest);
return Ok(result);
}
请求类
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": "<p>The retention file MXMT generation for the "<<EngagementName>>" did not complete successfully.<p><p>Please contact your local country helpdesk support function.<p><hr><i>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时,它可以正常工作,但不能在服务fabric节点上工作。
任何帮助都是可以接受的。
发布于 2021-03-26 20:23:25
此请求将由您服务前面的Azure应用程序网关停止。
https://learn.microsoft.com/en-us/azure/application-gateway/overview
Azure应用程序网关包括防火墙(WAF)
问题可能是WAF将您的请求标记为恶意。您需要首先检查防火墙上的日志,以了解它被阻塞的原因,然后禁用阻止请求的规则,或者创建一个异常规则以允许特定的url通过。
https://stackoverflow.com/questions/66821199
复制相似问题