本文介绍了Azure API管理REST API调用突然失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使我的API管理租户自动化,并突然在我的代码中收到"401未经授权"消息.有什么想法可以检测到为什么发生这种情况吗?

解决方案

查看一下您的请求中是否仍包含授权标头(可能会如此).在该处,您会看到一个查询字符串,如以& ex = [SOME DATA/TIME VALUE] 开头的值.像这样:

授权:SharedAccessSignature uid = 53dd860e1b72ff0467030003& ex = 2014-08-04T22:03:00.0000000Z& sn = ItH6scUyCazNKHULKA0Yv6T + Skk4bdVmLqcPPPdWoxl2n1 + rVbhKlf4c = Ch = Fc

这可能是过期的日期.在门户中或通过代码重新生成新的SAS.在Azure门户中,可以单击管理",在AAM门户中,单击安全",如下所述: https://msdn.microsoft.com/en-us/library/azure/dn798668.aspx#ProgrammaticallyCreateToken

I'm automating parts of my API Management tenant and suddenly receive '401 Unauthorized' messages in my code. Any ideas how I can detect why this is happening?

解决方案

heck to see if you still have an authorization header included in your requests (as probably will be the case). In there you see a querystring like value starting with &ex=[SOME DATA/TIME VALUE]. Like this:

Authorization: SharedAccessSignature uid=53dd860e1b72ff0467030003&ex=2014-08-04T22:03:00.0000000Z&sn=ItH6scUyCazNKHULKA0Yv6T+Skk4bdVmLqcPPPdWoxl2n1+rVbhKlplFrqjkoUFRr0og4wjeDz4yfThC82OjfQ==

This probably is an expired date. Regenerate a new SAS in the portal or through code. In the Azure portal you can click on Manage and in the AAM portal you click on 'Security', as described here: https://msdn.microsoft.com/en-us/library/azure/dn798668.aspx#ProgrammaticallyCreateToken

这篇关于Azure API管理REST API调用突然失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:56