发布Azure Web应用后POST请求出现500内部服务器错误
Azure Web API POST请求返回500认证错误但功能实际执行成功
问题现象
- 发送POST请求到Azure托管的Web API时,返回500内部服务器错误,响应体内容:
{"error": "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature."}
- 异常矛盾点:请求对应的业务功能实际已正常执行,未出现逻辑失败。
详细错误日志(Azure门户日志流获取)
<body> <div id="content"> <div class="content-container"> <h3>HTTP Error 500.0 - Internal Server Error</h3> <h4>The page cannot be displayed because an internal server error has occurred.</h4> </div> <div class="content-container"> <fieldset> <h4>Most likely causes:</h4> <ul> <li> IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred. </li> <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li> <li>IIS was not able to process configuration for the Web site or application.</li> <li>The authenticated user does not have permission to use this DLL.</li> <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul> </fieldset> </div> <div class="content-container"> <fieldset> <h4>Things you can try:</h4> <ul> <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li> <li>Check the event logs to see if any additional information was logged.</li> <li>Verify the permissions for the DLL.</li> <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li> <li> Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> </fieldset> </div> <div class="content-container"> <fieldset> <h4>Detailed Error Information:</h4> <div id="details-left"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"> <th>Module</th> <td> AspNetCoreModuleV2</td> </tr> <tr> <th>Notification</th> <td> ExecuteRequestHandler</td> </tr> <tr class="alt"> <th>Handler</th> <td> aspNetCore</td> </tr> <tr> <th>Error Code</th> <td> 0x00000000</td> </tr> </table> </div> <div id="details-right"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"> <th>Requested URL</th> <td> https://SFSPolicyControllerDev__73a0:80/api/policyRequests?clientId=sfspmnode</td> </tr> <tr> <th>Physical Path</th> <td> D:\home\site\wwwroot\api\policyRequests</td> </tr> <tr class="alt"> <th>Logon Method</th> <td> Anonymous</td> </tr> <tr> <th>Logon User</th> <td> Anonymous</td> </tr> </table> <div class="clear"></div> </div> </fieldset> </div> <div class="content-container"> <fieldset> <h4>More Information:</h4> This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error. <p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&IIS70Error=500,0,0x00000000,14393">View more information »</a></p> <p>Microsoft Knowledge Base Articles:</p> </fieldset> </div> </div> </body>
环境框架信息

已尝试的排查方案
- 检查存储账户和数据库防火墙设置,确保允许相关服务访问
- 在Azure门户中将数据库和存储账户密钥添加到应用配置
- 将
WEBSITE_NODE_DEFAULT_VERSION从6.9.1更新到8.9.4
以上方案均未解决问题,怀疑是配置问题,但无法定位具体原因,寻求修复建议,可提供更多信息。
内容的提问来源于stack exchange,提问作者try
相关产品推荐
相关产品推荐

