收藏
回答

您好!我想从asp.net core webapi 调用ocr.printedText,又没有参考?

我调的时候总是返回{"errcode":41005,"errmsg":"media data missing hint: [icaJuA08392347]"

回答关注问题邀请回答
收藏

2 个回答

  • john lone
    john lone
    2020-07-17
    string boundary = "--------------------------" + DateTime.Now.Ticks.ToString("x");
    string boundaryH = "------------------------" + DateTime.Now.Ticks.ToString("x");
    var formData = new MultipartFormDataContent(boundary);
    var contentSend = new StreamContent(flstream);
    	
    contentSend.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
    {
    	  Name = $"\"{contentName}\"",
    	  FileName = $"\"{filename}\""
     };
    	
    contentSend.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
    
    //改写Content-Type
    contentSend.Headers.Remove("Content-Type");
    contentSend.Headers.Add("Content-Type", "multipart/form-data; boundary=" + boundaryH);
    var boundaryA = formData.Headers.ContentType.Parameters.First(o => o.Name == "boundary");//关键代码
    boundaryA.Value = boundaryA.Value.Replace("\"", String.Empty);
    formData.Add(contentSend);
    	
    	            var clientToCall = new HttpClient(/* _proxy */);
    	            var token = await _accessTonkenService._GetAccessToken();
    var response = await clientToCall.PostAsync($"http://api.weixin.qq.com/cv/ocr/comm?access_token={token.access_token}" , formData);
    
    2020-07-17
    有用 1
    回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2020-05-29

    你好,麻烦提供下appid,具体的请求,请求时间

    2020-05-29
    有用
    回复 2
登录 后发表内容
问题标签