C# asynchronous method - help needed

后端 未结 3 1362
逝去的感伤
逝去的感伤 2021-01-17 03:17

I have an asynchronous method that consumes a Web API action. It appears to be stuck in a loop. My reasoning for this is because if I put a break point on line 1 of the catc

3条回答
  •  囚心锁ツ
    2021-01-17 04:00

    If it works with a web browser but not using code then you probably need to send an accept header. Add the following line

    _client.DefaultRequestHeaders.Accept = new MediaTypeWithQualityHeaderValue("application/json");
    

提交回复
热议问题