访问Azure MobileServices TableController时出现服务器错误

时间:2017-10-27 07:17:05

标签: azure xamarin.forms azure-mobile-services

我使用 Azure移动应用模板创建了 TableController API,并将其部署到azure。

我是通过网址测试的,当我使用以下网址

时,它工作正常
foo()

现在我创建了 Xamarin Forms 应用程序来使用它,我在日志中收到内部服务器错误但无法使用它。

http://rkXXXXXXXXXXX.azurewebsites.net/tables/Person/f90cb37d51a34f8cb97432a57000c876?ZUMO-API-VERSION=2.0.0

Azure日志记录错误

public IMobileServiceTable<Person> PersonOnlineTable { get; set; }
PersonOnlineTable = client.GetTable<Person>();
    public async Task SavePersonAsync(Person item)
    {
        if (item.Id == null)
        {
            await PersonOnlineTable.InsertAsync(item);
        }
        else
        {
            await PersonOnlineTable.UpdateAsync(item);
        }
    }

在应用程序中收到异常:

Detailed Error Information:
Module     __DynamicModule_Microsoft.Owin.Host.SystemWeb.OwinHttpModule, Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35_78a91520-ed4c-4317-9401-f8ad17a561a6
Notification       PreExecuteRequestHandler
Handler    ExtensionlessUrlHandler-Integrated-4.0
Error Code     0x00000000

Requested URL      http://rkXXXXXXXXXXX:80/tables/Person/f90cb37d51a34f8cb97432a57000c876
Physical Path      D:\home\site\wwwroot\tables\Person\f90cb37d51a34f8cb97432a57000c876
Logon Method       Anonymous
Logon User     Anonymous

我尝试多次部署服务器应用程序,它总是在MainURL上运行,而在从App调用时无效。有什么想法可以解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

问题发生的原因是模型对象中的数据类型不匹配。我有datetime对象,在数据库中定义为 datetimeoffset ,在DTO对象中定义为 datetime 。更改我的DTO对象的数据类型后,它工作正常。