异常:System.Net.WebException: Error writing request: The authentication or decryption has failed.
at System.Net.WebConnectionStream.WriteHeaders () [0x00000] in :0
at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Net.WebConnectionStream:SetHeaders (byte[])
at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error) [0x00000] in :0
有谁做过么,求指点一二。
导入库,就几行代码,不知怎么处理,运行抛出上面的异常
client = new Ocr(API_KEY, SECRET_KEY);
byte[] image = File.ReadAllBytes(@"D:\\img.jpg");
try
{
//调取API是哦图片文字
var result = client.GeneralBasic(image);
//打印获取到的结果
Debug.Log(result);
}
catch (Exception e)
{
//打印异常信息
Debug.Log("异常:" + e);
}
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
如果成功有值,这是返回一个json格式的字符串。
有值是能输出的{"log_id": 8925564128101011311, "words_result_num": 1, "words_result": [{"location": {"width": 89, "top": 0, "left": 84, "height": 47}, "words": "2020"}]
就是取的这2俩个值
确保client = new Ocr(API_KEY, SECRET_KEY); 是应用中获取到的。而不是账户中心的AccessKey
确保是图中红框下的俩个值
//打印获取到的结果
Debug.Log(result);
这一步是什么内容呢?如果你也是C#刚入门。建议找一些有经验的人。