亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

POST Guid to WebAPI 接收為 NULL

POST Guid to WebAPI 接收為 NULL

牛魔王的故事 2021-11-21 10:07:39
所以我決定在這里寫下我自己的答案,因為我不確定其他人是否會解決這個問題。我懷疑的一件事是我最近將 C# 語言更新到了 v7.3,因為 VS 2017 在編寫一些代碼時是這樣說的。也許問題與此有關,但到目前為止我的解決方案在最小化狀態下工作。我還想在此聲明,我BackgroundTask首先實施以ApplicationTrigger在需要時觸發該過程來克服這個問題,但老實說這是一種黑客攻擊。看一下代碼:public static async Task<string> GetBackgroundTaskReturnValue(string apiRequestUrl){        StaticItemsHelper.IsBackgroundPlaylistTaskRunning = true;        if (StaticItemsHelper.IsBackgroundPlaylistTaskRunning)        {            for (int seconds = 0; seconds < 20;)            {                if (!StaticItemsHelper.IsBackgroundPlaylistTaskRunning)                {                    break;                }                else                {                    Task.Delay(1000).Wait();                }            }        }        var request = BackgroundTaskHelper.BackgroundPlaylistTrigger.RequestAsync().GetResults();        if (request == Windows.ApplicationModel.Background.ApplicationTriggerResult.Allowed)        {            SettingsHelper.localSettings.Values[SettingsHelper.BackgroundPlaylistPlaybackURLKey] = apiRequestUrl;            SettingsHelper.localSettings.Values[SettingsHelper.BackgroundPlaylistPlaybackTokenKey] = StaticItemsHelper.CurrentUserAccessToken;            if (SettingsHelper.tempFolder.TryGetItemAsync(SettingsHelper.BackgroundPlaylistPlaybackReturnKey).GetResults() is StorageFile file)            {                await file.DeleteAsync();            }            for (int seconds = 0; seconds < 30;)            {                if (SettingsHelper.tempFolder.TryGetItemAsync(SettingsHelper.BackgroundPlaylistPlaybackReturnKey).GetResults() is StorageFile _rfile)                {
查看完整描述

1 回答

?
守著一只汪

TA貢獻1872條經驗 獲得超4個贊

您確定 String 名稱在 json 中傳遞了值嗎?如果你想用 JsonSerializer 反序列化,我認為像你 TransferObject 這樣的公共 api 不應該有內部屬性(和內部 setter 或 getter)。JsonSerializer 是外部 .dll 并且無法訪問您的 setter。

讓我們嘗試使用公共二傳手。


查看完整回答
反對 回復 2021-11-21
  • 1 回答
  • 0 關注
  • 257 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號