Web API从图片发送字节数组给出404

时间:2017-05-20 18:26:09

标签: asp.net asp.net-web-api web-applications asp.net-web-api2

我需要帮助我的WebAPI。我在服务器中有以下内容:

 [System.Web.Http.HttpGet]
        public HttpResponseMessage Recognize(byte[] img)
        { 

        }

我的客户要求:

  using (var client = new HttpClient())
            {

                client.BaseAddress = new Uri("http://localhost/MP.Business.Implementation.FaceAPI/");
                using (var request = new HttpRequestMessage(HttpMethod.Get, client.BaseAddress))
                {
                    var imageStream = new ByteArrayContent(pic);
                    var multi = new MultipartContent();
                    multi.Add(imageStream);

                    //   var response = client.
                    HttpResponseMessage response = client.GetAsync("api/Recognition/Recognize/"+ multi).Result;

断点未命中,我得到404.但是,如果我发送此请求:

 HttpResponseMessage response = client.GetAsync("api/Recognition/Recognize/").Result;

断点被击中并且显然我在内部得到错误,因为byte []为空(但至少它命中)。我做错了什么?

0 个答案:

没有答案