【发布时间】:2021-06-23 12:48:43
【问题描述】:
当我尝试将以下请求发送到 .net core web api 时,我收到错误为“403 Forbidden - Microsoft-Azure-Application-Gateway/v2”。我已经为 encodeEmailBody 属性使用了 HTML 编码。
Web API 代码:-
[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 时,它可以正常工作,但不能在 Service Fabric 节点上工作。
如有任何帮助,将不胜感激。
【问题讨论】:
标签: c# .net azure asp.net-web-api asp.net-core-webapi