The remote server returned an error: (403) Forbidden

后端 未结 10 1410
半阙折子戏
半阙折子戏 2020-12-15 03:16

I\'ve written an app that has worked fine for months, in the last few days I\'ve been getting the error below on the installed version only.

If I run the source code

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 04:11

    In my case, I had to call an API repeatedly in a loop, which resulted in halt of my system returning a 403 Forbidden Error. Since my API provider does not allow multiple requests from the same client within milliseconds, I had to use a delay of 1 second at least :

    foreach (var it in list)
    {
        Thread.Sleep(1000);
        // Call API
    }
    

提交回复
热议问题