![](/img/trans.png)
[英]ASP.NET Core Migration from 2.1 -> 2.2 Issue with dependencies in Azure deployment
[英]Azure Mobile Backend connection issue on ASP.Net Core 2.1
我正在使用ASP.Net Core Web應用程序,嘗試通過Azure移動后端將其連接。
后端可以與其他Windows桌面應用程序很好地協作。 到目前為止,后端與ASP.Net Core v2.0的運行情況都很好。 昨天我安裝了ASP.Net Core 2.1 SDK,並將Microsoft.AspNetCore.All nuget軟件包從2.0更新到2.1.2,此后,我收到以下異常:MobileServiceInvalidOperationException-“服務器未提供預期的響應內容。”
您能告訴我解決這個問題的任何解決方案嗎?
到目前為止,后端與ASP.Net Core v2.0的運行情況都很好。 昨天我安裝了ASP.Net Core 2.1 SDK,並將Microsoft.AspNetCore.All nuget軟件包從2.0更新到2.1.2,此后,我收到以下異常:MobileServiceInvalidOperationException-“服務器未提供預期的響應內容。”
根據您的描述,您的Azure移動后端可以與ASP.Net Core v2.0一起正常工作。 AFAIK,移動后端只是為您提供公開Table / API端點的簡單方法。 此外,您的Web應用如何使用HttpClient或Azure Mobile Client SDK與移動后端連接?
作為解決此問題的簡單方法,可以為Azure移動應用啟用診斷日志記錄以檢索詳細的錯誤消息以縮小此問題的范圍,您可以在此處關注詳細信息。
我有同樣的問題,但沒有解決方案。 我在SendRequestAsync(...)
函數中將其SendRequestAsync(...)
MobileServiceHttpClient
代碼的以下代碼行。
// If there was supposed to be response content and there was not, throw
if (ensureResponseContent)
{
long? contentLength = null;
if (response.Content != null)
{
contentLength = response.Content.Headers.ContentLength;
}
if (contentLength == null || contentLength <= 0)
{
throw new MobileServiceInvalidOperationException("The server did not provide a response with the expected content.", request, response);
}
}
查看response.Content.Headers.ContentLength
它為null
。 將應用程序作為2.0核心項目運行時,該值已正確填寫。 奇怪的是內容在那里。
如果您深入研究私有成員,則其中一些成員的設置正確。
catch (MobileServiceInvalidOperationException msioe)
{
//content will contain the correct json but the ContentLenth is null!?!
string content = await msioe.Response.Content.ReadAsStringAsync();
}
這是一個2.1核心問題。 希望他們修復它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.