0

这个错误“

WindowsAzure.MobileServices 您要查找的资源已被删除、名称已更改或暂时不可用”

尝试从连接到应用服务的 Azure SQL Db 检索记录时发生。它发生在下面的代码行

await SurveyResponseTable.PullAsync("SurveyResponse", SurveyResponseTable.CreateQuery()).ConfigureAwait(false);

在哪里;

SurveyResponseTable = mClient.GetSyncTable<SurveyResponse>();

mClient = new MobileServiceClient(Constants.BackendUrl);

我已阅读有关此错误的所有 SO 引用,但找不到解决方案。我不确定 Azure SQL Db 上的表是否与移动客户端上的类有一些差异,是权限问题还是什么。

所以在这个阶段,我正在寻求关于如何调试、寻找什么的建议(在异常细节方面找不到任何帮助我的东西)。或者也许如何在服务器端正确创建表。我在玩 ToDoItem 示例时看到,小事情可能会阻止成功连接,例如拼写错误、EF 在服务器表名称上使用复数、小写 id 等。尝试了所有这些事情但仍然是同样的错误。

Azure SQL 表结构;

    CREATE TABLE [dbo].[SurveyResponses] (
    [id]             NVARCHAR (128)     DEFAULT (newid()) NOT NULL,
    [ThinkingStyle]  NVARCHAR (128)     NULL,
    [ThinkingStyleA] NVARCHAR (128)     NOT NULL,
    [ThinkingStyleB] NVARCHAR (128)     NULL,
    [ResponseOrder]  INT                NOT NULL,
    [ResponseGroup]  NVARCHAR (128)     NOT NULL,
    [Question]       NVARCHAR (128)     NULL,
    [ResponseA]      NVARCHAR (512)     NOT NULL,
    [ResponseB]      NVARCHAR (512)     NULL,
    [AzureVersion]   ROWVERSION         NOT NULL,
    [CreatedAt]      DATETIMEOFFSET (7) DEFAULT (sysutcdatetime()) NOT NULL,
    [UpdatedAt]      DATETIMEOFFSET (7) NULL,
    [Deleted]        BIT                DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_dbo.SurveyResponses] PRIMARY KEY NONCLUSTERED ([id] ASC));
    GO CREATE CLUSTERED INDEX [IX_CreatedAt]
    ON [dbo].[SurveyResponses]([CreatedAt] ASC);
GO CREATE TRIGGER [TR_dbo_SurveyResponses_InsertUpdateDelete] ON [dbo].[SurveyResponses] AFTER INSERT, UPDATE, DELETE AS BEGIN UPDATE [dbo].[SurveyResponses] SET [dbo].[SurveyResponses].[UpdatedAt] = CONVERT(DATETIMEOFFSET, SYSUTCDATETIME()) FROM INSERTED WHERE inserted.[id] = [dbo].[SurveyResponses].[id] END

这是移动客户端类;

    public class SurveyResponse
{
    public string id { get; set; }
    public string ThinkingStyle { get; set; }
    public string ThinkingStyleA { get; set; }
    public string ThinkingStyleB { get; set; }
    public int ResponseOrder { get; set; }
    public string ResponseGroup { get; set; }
    public string Question { get; set; }
    public string ResponseA { get; set; }
    public string ResponseB { get; set; }
    [Version]
    public string AzureVersion { get; set; }
    [CreatedAt]
    public DateTime CreatedAt { get; set; }
    [UpdatedAt]
    public DateTime UpdatedAt { get; set; }

}
4

0 回答 0