RestBed:当并发请求数达到某个点时,RestBed API抛出“对等方重置连接”

我们正在使用RestBed处理我们的C ++微服务。

将并发请求发送到服务器。当并发请求数达到某个点时,开始从服务器看到以下错误:

  

卷曲:(56)接收失败:对等重置连接

我们的代码段如下。

class Program
{
    private static HttpClient client = new HttpClient();

    static async Task Main(string[] args)
    {
        var blobs = new List<Blob>();
        await ProcessBlobs(blobs);
        Console.ReadLine();
    }

    public static async Task ProcessBlobs(IEnumerable<Blob> blobs)
    {

        var tasks = blobs.Select(currentblob =>
        {
            string FileUrl = currentblob.Uri.ToString();
            string FileName = currentblob.Uri.Segments.Last();
            //string content = "{ \"fileUri\": \""+ currentblob.Uri.ToString()+ "\",\"fileName\": \""+ currentblob.Uri.Segments.Last()+"\"}";
            Console.WriteLine(currentblob.Uri + " #### " + currentblob.Uri.Segments.Last());
            var values = new Dictionary<string,string>
                    {
                        { "fileUri",currentblob.Uri.ToString() },{ "fileName",currentblob.Uri.Segments.Last() }
                    };
            var content = new FormUrlEncodedContent(values);
            string baseURL = @"https://<afu>.azurewebsites.net/api/process_zip_files_by_http_trigger?code=45"; ;
            //string urlToInvoke = string.Format("{0}&name={1}",baseURL,FileUrl,FileName);


            return RunAsync(baseURL,content);
        });
        await Task.WhenAll(tasks);
    }

    public static async Task RunAsync(string i_URL,FormUrlEncodedContent content)
    {
        var response = await client.PostAsync(i_URL,content);
        var responseString = await response.Content.ReadAsStringAsync();
        Console.WriteLine(responseString);
    }
}

这是框架的限制吗?对解决此问题有帮助吗?

谢谢

zhangyansong 回答:RestBed:当并发请求数达到某个点时,RestBed API抛出“对等方重置连接”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3165342.html

大家都在问