我跟随Adrian Hall ZUMO BOOK在git hub并试图重新创建他在他的书中显示的所有样本实际上我在第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."}
老实说,我不明白错误在哪里或者它是如何停止工作的我检查了我的天蓝色移动应用程序配置,一切似乎都没问题。
我的后端服务器上一定是个错误。 如果有人可以帮助我学习如何解决这个错误?或者如何调试它以便了解它的更多信息。
我将非常感谢您的帮助,谢谢!
当我调用不需要身份验证的CustomController时,postman的作品会找到但不在任何需要auth的桌面控制器或需要它的自定义控制器。它向我发送了相同的内部错误。
这是Adrian hall ZUMO BOOK:https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter4/recipes/
答案 0 :(得分:1)
我的后端服务器上一定是个错误。如果有人可以帮助我学习如何解决这个错误?或者如何调试它以便了解它的更多信息。
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