第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

AggregateException "發(fā)生一個或多個錯誤。發(fā)送請求時發(fā)生錯誤。"

AggregateException "發(fā)生一個或多個錯誤。發(fā)送請求時發(fā)生錯誤。"

C#
喵喵時光機(jī) 2021-10-31 10:13:41
我試圖將文件從我的 WCF .Net 框架 4.5 發(fā)布到 API 休息區(qū)。這是我的代碼:public string CreateConclusion(string[] instanceUIDs)    {        var root = @"C:\";        string filename = "1.2.840.114257.1.9.1245.56421.52314.1119854.01248.dcm";            using (var client = new HttpClient())            {                var stream = new FileStream(root + filename, FileMode.Open);                using (var content =                    new MultipartFormDataContent("Upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture)))                {                    content.Add(new StreamContent(stream), "fileToUpload", filename);                    using (var message = client.PostAsync("https://localhost:44343/api/ConclusionReports/UploadFile", content).Result)                    {                        var input = message.Content.ReadAsStringAsync();                        return !string.IsNullOrWhiteSpace(input.Result) ? Regex.Match(input.Result, @"http://\w*\.directupload\.net/images/\d*/\w*\.[a-z]{3}").Value : null;                    }                }            }    }它不起作用并拋出異常:“發(fā)生一個或多個錯誤。發(fā)送請求時發(fā)生錯誤。”有沒有人可以幫我解決這個問題?先感謝您
查看完整描述

1 回答

?
一只萌萌小番薯

TA貢獻(xiàn)1795條經(jīng)驗 獲得超7個贊

總是可以解開聚合異常以發(fā)現(xiàn)真正的原因。嘗試在 try-catch 中編寫您的客戶端調(diào)用,如下所示:


    try {



    //Some risky client call that will call parallell code / async /TPL or in some way cause an AggregateException 


   }

   catch (AggregateException err){

    foreach (var errInner in err.InnerExceptions) {

     Debug.WriteLine(errInner); //this will call ToString() on the inner execption and get you message, stacktrace and you could perhaps drill down further into the inner exception of it if necessary 

     }   

   }


查看完整回答
反對 回復(fù) 2021-10-31
  • 1 回答
  • 0 關(guān)注
  • 302 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號