错误401未经授权 [英] Error 401 Unauthorized
问题描述
我需要帮助,我不知道我做错了什么。
I need help, I Don't know what I'm doing wrong.
重现的步骤:
1)在 http://www.projectoxford.ai注册:创建帐户并创建密码。我可以毫无问题地登录网站
1) Signup at http://www.projectoxford.ai : account created and password created. I can log-in to the web site without issues
2)向上,在网站上,点击我的名字,点击订阅并创建"Speech API"的主要和次要密钥 - 免费" cuota说我在2016年1月19日之前有5000个电话
2) Up right, on the web site, On my name, clicked on Subscriptions and created primary and secondary key to "Speech API - Free" the cuota says I've 5000 calls before 19/1/2016
3)从https://github.com/Microsoft/ProjectOxford-ClientSDK下载了c#客户端SDK并替换了ClientID和密码我用来在网上验证的电子邮件和密码。
3) Downloaded c# client SDK from https://github.com/Microsoft/ProjectOxford-ClientSDK and replaced the ClientID and Secret with the email and password I'm using to authenticate on the web.
该代码的第149行总是引发异常,错误代码为401
Line 149 of that code always raise exception and error code is 401
{Pragma:no-cache
内容 - 长度:143
缓存控制:无缓存
内容类型:application / json
到期日:-1
Set-Cookie:ai_session = 0092ce90e42147a79acf000e5ba292d6 | 2015-12-21T11:54:53.8670003 + 00:00 | 2015-12-21T11:54 :55.0572433 + 00:00;到期=星期一,2015年12月21日12:24:55 GMT;路径= /,ai_user = ab4ec1f6bd07419a8062dea129d1fdcf | 2015-12-21T11:54:53.8670003 + 00:00;
到期=星期五,1999年12月31日23:59:59 GMT; path = /
$
服务器:Microsoft-IIS / 8.5
WWW-Authenticate:AzureApiManagementKey realm =" https://api.projectoxford.ai/speech/v0", name =" Ocp-Apim-Subscription-Key",type =" header"
X-AspNet-Version:4.0.30319
X-Powered-By: ASP.NET
日期:星期一,2015年12月21日11:54:54 GMT
}
{Pragma: no-cache
Content-Length: 143
Cache-Control: no-cache
Content-Type: application/json
Expires: -1
Set-Cookie: ai_session=0092ce90e42147a79acf000e5ba292d6|2015-12-21T11:54:53.8670003+00:00|2015-12-21T11:54:55.0572433+00:00; expires=Mon, 21-Dec-2015 12:24:55 GMT; path=/,ai_user=ab4ec1f6bd07419a8062dea129d1fdcf|2015-12-21T11:54:53.8670003+00:00;
expires=Fri, 31-Dec-9999 23:59:59 GMT; path=/
Server: Microsoft-IIS/8.5
WWW-Authenticate: AzureApiManagementKey realm="https://api.projectoxford.ai/speech/v0",name="Ocp-Apim-Subscription-Key",type="header"
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 21 Dec 2015 11:54:54 GMT
}
任何想法?
推荐答案
回答我自己的问题,以防更多人受益
Answering my own question in case it helps more people
在第3步,"秘密" (在代码中)指的是"主键"。而不是帐户密码。
On step 3, "Secret" (in the code) refers to the "Primary Key" and not the account password.
这篇关于错误401未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!