我怎么搞砸了我的 azure 移动应用程序服务器????? ZUMO 图书样本

How did I messed up my azure mobile app server?????? ZUMO BOOK Sample

我在 git 中心关注 Adrian Hall ZUMO BOOK 并尝试重新创建他在书中显示的所有样本实际上我在服务器端代码的第 4 章中,我正在尝试上传本书的文件部分。

但是当我使用邮递员检查我的服务器时,它突然停止验证我的读取请求或写入,它只显示错误代码 500 内部服务器错误。

所以每当我尝试 SyncofflineCache 时,我的程序都会抛出异常,但我似乎无法弄清楚它是什么。

我使用日志来找出错误,这就是我能得到的:

In TaskListViewModel
InitializeAsync: Initializing store
'TodoList.UWP.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
InitializeAsync: Defining Datastore
InitializeAsync: Initializing SyncContext
CREATE TABLE IF NOT EXISTS [TodoItem] ([id] TEXT PRIMARY KEY, [text] TEXT, [complete] BOOLEAN, [tagid] TEXT, [UpdatedAt] DATETIME, [CreatedAt] DATETIME, [Version] BLOB)
CREATE TABLE IF NOT EXISTS [Tag] ([id] TEXT PRIMARY KEY, [TagName] TEXT, [UpdatedAt] DATETIME, [CreatedAt] DATETIME, [Version] BLOB)
CREATE TABLE IF NOT EXISTS [__operations] ([id] TEXT PRIMARY KEY, [kind] INTEGER, [state] INTEGER, [tableName] TEXT, [tableKind] INTEGER, [itemId] TEXT, [item] TEXT, [createdAt] DATETIME, [sequence] INTEGER, [version] INTEGER)

CREATE TABLE IF NOT EXISTS [__errors] ([id] TEXT PRIMARY KEY, [httpStatus] INTEGER, [operationVersion] INTEGER, [operationKind] INTEGER, [tableName] TEXT, [tableKind] INTEGER, [item] TEXT, [rawResult] TEXT)
CREATE TABLE IF NOT EXISTS [__config] ([id] TEXT PRIMARY KEY, [value] TEXT)
BEGIN TRANSACTION
INSERT OR IGNORE INTO [__config] ([id]) VALUES (@p0)
@p0 : systemProperties|TodoItem
UPDATE [__config] SET [value] = @p0 WHERE [id] = @p1
@p0 : 0
@p1 : systemProperties|TodoItem
COMMIT TRANSACTION
BEGIN TRANSACTION
INSERT OR IGNORE INTO [__config] ([id]) VALUES (@p0)
@p0 : systemProperties|Tag
UPDATE [__config] SET [value] = @p0 WHERE [id] = @p1
@p0 : 0
@p1 : systemProperties|Tag
COMMIT TRANSACTION
SELECT * FROM [__operations] ORDER BY [sequence] DESC LIMIT 1
SELECT COUNT(1) AS [count] FROM [__operations]
{
  "count": 0
}
InitializeAsync: Syncing Offline Cache
InitializeAsync: Short Circuit
Connected to https://chapter1-backendtest.azurewebsites.net/ right now - online
SELECT * FROM [__operations] WHERE (([tableKind] = @p1) AND ([sequence] > @p2)) ORDER BY [sequence] LIMIT 1
@p1 : 0
@p2 : 0
SELECT * FROM [__errors]
DELETE FROM [__errors] WHERE [id] IN (SELECT [id] FROM [__errors])
InitializeAsync: Short Circuit
SELECT * FROM [__operations] WHERE ([tableName] = @p1) LIMIT 0
@p1 : TodoItem
SELECT COUNT(1) AS [count] FROM [__operations] WHERE ([tableName] = @p1)
@p1 : TodoItem
{
  "count": 0
}
SELECT * FROM [__config] WHERE id = @id
@id : deltaToken|TodoItem|incsync_TodoItem
Request: GET, https://chapter1-backendtest.azurewebsites.net/tables/TodoItem?$filter=(updatedAt ge datetimeoffset'1970-01-01T00:00:00.0000000%2B00:00')&$orderby=updatedAt&$skip=0&$top=50&__includeDeleted=true
Response: InternalServerError
{"message":"An error has occurred."}

老实说,我不明白错误在哪里或者它是如何停止工作的我已经检查了我的 azure 移动应用程序配置,一切似乎都正常。

一定是我的后端服务器出错了。 如果有人可以帮助我了解如何解决此错误?或如何调试它以了解更多信息。

非常感谢您的帮助,谢谢!!!

当我调用不需要身份验证的 CustomController 时,邮递员可以找到但在任何不需要身份验证的 table 控制器或需要它的自定义控制器中。它向我发送相同的内部错误。

这是 Adrian hall ZUMO BOOK:https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter4/recipes/

It must be a error on my backend server. If someone could help me out to learn how to solve this error? or how to debug it in order to find out more about it.

AFAIK,您可以编辑 App_Start\Startup.MobileApp.cs 文件并按如下方式配置 IncludeErrorDetailPolicy 以捕获错误详细信息:

HttpConfiguration config = new HttpConfiguration();
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

此外,您可以记录或本地调试您的 Azure 移动应用程序后端。这里有一些教程,你可以参考它们:

Debug and troubleshoot the .NET Server SDK

Local development and debugging the Mobile App .NET server backend