getasync

localhost route not working should be returning JSON back when locating to URL

有些话、适合烂在心里 提交于 2019-12-24 19:03:54
问题 My fellow programmers, I basically have this async Get() method which is reading Json data successfully, but when locating to route -> localhost:59185/api/encompass/data I receive a message: No HTTP resource was found that matches the request URL 'http://localhost:59185/api/encompass/data'. </Message> I was very hopeful that it would return my JSON especially when in debug the code its sitting in 'string res' at the bottom anyone know why its not returning Json even thought its sitting in

Check GetStreamAsync status

淺唱寂寞╮ 提交于 2019-12-12 03:19:07
问题 Grabbing an image via GetStreamAsync , how do I determine status? HttpClient OpenClient = new HttpClient(); Stream firstImageStream = OpenClient.GetStreamAsync("imageUrl.jpg").Result; Sometimes this will give an error (403 or 404 typically) and I simply want to skip processing those results. All I can find says to use the StatusCode property or IsSuccessStatusCode , but those seem to only work on HttpResponseMessage , which is from GetAsync, which does not give me the Stream I need to process