简体   繁体   English

带有.NET后端的Azure移动服务获取异常

[英]Azure Mobile Service with .NET Backend get exception

When adding an entity with a child entity (1:n) I'm getting an exception. 当添加带有子实体(1:n)的实体时,出现异常。 I can only get this exception when the debugger is catching all exceptions. 当调试器捕获所有异常时,我只能获取此异常。 Unfortunately only the message of the exception is visible and not the exception itself with the information I need. 不幸的是,只有异常的消息是可见的,而异常本身以及我所需要的信息却不可见。 (System.Data.Entity.Validation.DbEntityValidationException) (when inserting an entity without childs the service works correct) (System.Data.Entity.Validation.DbEntityValidationException)(当插入不带子项的实体时,服务正常工作)

The client gets a MobileServiceInvalidOperationException: The request could not be completed. 客户端获取MobileServiceInvalidOperationException:请求无法完成。 (Bad Request) (错误的请求)

The method on the controller (PatchAppointment) is the only method where I can add exceptionhandling and the exception is not coming in here. 控制器上的方法(PatchAppointment)是我可以添加异常处理的唯一方法,并且这里没有异常。

 public Task<Appointment> PatchAppointment(string id, Delta<Appointment> patch)
    {
        try
        {
            return UpdateAsync(id, patch);
        }
        catch (Exception ex)
        {
            // not coming through here..
            throw;
        }             
    }

I also tried adding an ExceptionLogger to the Httpconfiguration.Services but no exception is coming in. 我还尝试将ExceptionLogger添加到Httpconfiguration.Services中,但没有例外。

How should I get the whole exception object to see the EntityValidationErrors? 我应该如何获取整个异常对象以查看EntityValidationErrors? When this is known I can also add logging when exceptions occur. 如果知道这一点,我也可以在发生异常时添加日志记录。

What do you mean by "PatchAppointment in the only method" that you can add exception handling? 您可以添加异常处理的“唯一方法中的PatchAppointment”是什么意思? If you have trouble inserting you have to check PostAppointment not PatchAppointment. 如果您在插入时遇到麻烦,则必须检查PostAppointment而不是PatchAppointment。 PatchAppointment deals with updating data while you mentioned that you have trouble inserting into your table. 当您提到无法插入表时,PatchAppointment处理更新数据。

public async Task<IHttpActionResult> PostAppointment(Appointment item)
{
    Appointment current = await InsertAsync(item);
    return CreatedAtRoute("Tables", new { id = current.Id }, current);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有.NET后端的Azure移动服务中的存储过程? - Stored procedures in Azure Mobile Service with .NET backend? 从.NET Backend Azure Mobile Service中的身份验证令牌获取名称,电子邮件ID等用户信息 - Get user info like name, email Id etc from authentication token in .NET Backend Azure Mobile Service 将新表添加到.NET后端Windows Azure移动服务 - Add a new table to a .NET backend Windows Azure Mobile Service 如何使用.NET在Azure移动服务后端上调用api /状态? - How to call the api/status on a Azure Mobile Service backend using .NET? 移动Azure服务C#.NET后端补丁未更新 - Mobile Azure Service C# .NET Backend PATCH not updating 在Azure移动服务.NET中使用DTO会引发目标调用异常 - Using DTO in Azure Mobile Service .NET throws target invocation exception Azure-此服务是不健康的.NET后端 - Azure - This Service is unhealthy .NET Backend 使用.Net后端Azure移动服务中的Microsoft帐户对用户进行身份验证,登录后出现错误 - Authenticate user using Microsoft Account in .Net backend Azure Mobile service giving error after login 找不到Azure移动服务端点(.NET后端) - Azure Mobile Services Endpoint not found (.NET backend) Azure移动服务.Net后端计划程序错误 - Azure Mobile Services .Net Backend Scheduler Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM