Linq和SQL Azure starnge行为
我正在创建一个新的Xamarin表单应用程序,并使用连接到SQL Azure数据库的Azure移动应用程序 下面是我为查询表而编写的代码:Linq和SQL Azure starnge行为,linq,xamarin.forms,azure-sql-database,azure-web-app-service,azure-mobile-services,Linq,Xamarin.forms,Azure Sql Database,Azure Web App Service,Azure Mobile Services,我正在创建一个新的Xamarin表单应用程序,并使用连接到SQL Azure数据库的Azure移动应用程序 下面是我为查询表而编写的代码: IEnumerable<Club> clubs = await (from club in ClubManager.DefaultManager.ClubTable.CreateQuery() where club.Nom.Contains(TexteRecherche)
IEnumerable<Club> clubs = await (from club in ClubManager.DefaultManager.ClubTable.CreateQuery()
where club.Nom.Contains(TexteRecherche)
select club).ToEnumerableAsync();
IEnumerable clubs=wait(来自ClubManager.DefaultManager.ClubTable.CreateQuery()中的club)
club.Nom.包含的位置(TexteRecherche)
选择club).ToEnumerableAsync();
我随机得到以下异常:
The exception
Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException occurred
HResult=0x80131509
Message=The request could not be completed. (Bad Request)
Source = <Unable to evaluate the source of the exception>
Procedural Call Tree:
à Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.<ThrowInvalidResponse>d__24.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.<SendRequestAsync>d__26.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.<RequestAsync>d__18.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.WindowsAzure.MobileServices.MobileServiceTable.<ReadAsync>d__20.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.WindowsAzure.MobileServices.MobileServiceTable.<ReadAsync>d__18.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider.<Execute>d__8`1.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider.<Execute>d__7`1.MoveNext()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
à EagleGolf.CourseEditor.ViewModels.MainPageViewModel.<LitClubs>d__23.MoveNext() dans D:\Julien\MobileApps\EagleGolf.CourseEditor\EagleGolf.CourseEditor\EagleGolf.CourseEditor\ViewModels\MainPageViewModel.cs :ligne 107
build : `
异常
发生Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException
HResult=0x80131509
Message=请求无法完成。(请求错误)
来源=
过程调用树:
§Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d_u24.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d_u26.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d_u18.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§Microsoft.WindowsAzure.MobileServices.MobileServiceTable.d_u20.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§Microsoft.WindowsAzure.MobileServices.MobileServiceTable.d_u18.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider.d_u8`1.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider.d_u7`1.MoveNext()
§System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)
§System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)
§System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
a EagleGolf.CourseEditor.ViewModels.MainPageViewModel.d_23.MoveNext()dans d:\Julien\MobileApps\EagleGolf.CourseEditor\EagleGolf.CourseEditor\EagleGolf.CourseEditor\EagleGolf.CourseEditor\ViewModels\mainpageviewmodels.cs:ligne 107
建造:`
这是非常奇怪的,因为我关闭并再次启动应用程序,然后它再次工作。它可以工作2-3次,然后停止工作,然后再次工作
我的数据库仅包含1个表,此表仅包含2条记录
IEnumerable<Club> clubs = await (from club in ClubManager.DefaultManager.ClubTable.CreateQuery()
where club.Nom.Contains(TexteRecherche)
select club).ToEnumerableAsync();
Message=请求无法完成。(错误请求)
我假设您可以在调用相关查询时利用并检查代码,如下所示:
根据您在数据访问中使用的内容,您需要将其配置为在使用SQLAzure操作时更能适应数据连接问题。例如,对于Entity Framework,SQLAzure有一个特定的执行策略配置:对于其他数据检索选项,您需要/w SQL Azure采取类似的步骤。
Get https://{your-app-name}.azurewebsites.net/tables/{table-name}?$filter=substringof('{TexteRecherche}',Nom)