首页 > 解决方案 > C# WebClient UploadValues 卡住了

问题描述

我正在尝试在 API 上发布数据但看起来它卡在 Amazon Cloud Windows 机器上的 webClient.UploadValues 行,它在本地 Windows 计算机上运行良好,但不能在它卡住的 AWS Windows 机器上运行,是否存在不同的架构或任何其他设置需要在 AWS Windows 机器上运行它。

  foreach  (string filename in filePaths)
            {
                string payload = System.IO.File.ReadAllText(filename);
                using (WebClient webClient = new System.Net.WebClient())
                {
                    var _postParams = new System.Collections.Specialized.NameValueCollection();
                    webClient.Headers.Add("headertoken", Common._WebAPIKey);
                    byte[] responseByes = webClient.UploadValues(Common._APIURL, "POST", payload);
                    _returnValue = Encoding.UTF8.GetString(responseByes);
                }
                _filename = filename;
                System.IO.File.Delete(filename);                    
            }

标签: c#amazon-web-serviceswebclient

解决方案


推荐阅读