I have a strange problem with the Microsoft Azure Mobile Backend for a while. Usually the first query (an automatic user check) fails at first run, after 30-60 sec of waiting it returns an error. After this error it works perfectly. I experienced this issue approximately once in a 24 hours time period.
The code is:
Step1: Initializing the backend (and after the related tables with this backend)
Backend.Primary = new Backend("https://....azurewebsites.net");
Step2: The failed query is
public async Task<Tuple<Result, TeguUsers>> FindUserPC1NIC(string mac)
{
try
{
IMobileServiceTableQuery<TeguUsers> query = TeguUsersTable.Where(user => user.M1Mac1 == mac || user.M1Mac2 == mac );
List<TeguUsers> result = await query.ToListAsync();
return CreateFoundUsersResult(result);
}
catch (MobileServiceConflictException msce)
{
return new Tuple<Result, TeguUsers>(new Result("Failed [msce]", msce.Message), null);
}
catch (MobileServicePreconditionFailedException mspfe)
{
return new Tuple<Result, TeguUsers>(new Result("Failed [mspfe]", mspfe.Message), null);
}
catch (MobileServiceInvalidOperationException msioe)
{
return new Tuple<Result, TeguUsers>(new Result("Failed [msioe]", msioe.Message), null);
}
catch (MobileServiceODataException msode)
{
return new Tuple<Result, TeguUsers>(new Result("Failed [msode]", msode.Message), null);
}
catch (Exception ex)
{
return new Tuple<Result, TeguUsers>(new Result("Failed", ex.Message), null);
}
}
Before I was using it with general Exception, today I added the specific Exceptions.
Can you tell me how to fix this problem?
Change anything in my code?
Change anything at backend side?
Anything else more advanced debugging technique?
A similar exception message is:
Message The request could not be completed. (Internal Server Error)
Request {Method: GET, RequestUri: 'https://....azurewebsites.net/tables/TeguUsers?$filter=((((((M1Mac1 eq '####') or (M1Mac2 eq '####')) or (M2Mac1 eq '####')) or (M2Mac2 eq '####')) or (M3Mac1 eq '####')) or (M3Mac2 eq '####'))&$top=1', Version: 1.1, Content: , Headers: { X-ZUMO-FEATURES: TT X-ZUMO-INSTALLATION-ID: 7a813fc5-f5cd-47ce-97a2-9b388cb3e159 Accept: application/json User-Agent: ZUMO/4.0 User-Agent: (lang=Managed; os=Windows; os_version=6.2.0.9200; arch=Win32NT; version=4.0.1.0) X-ZUMO-VERSION: ZUMO/4.0 (lang=Managed; os=Windows; os_version=6.2.0.9200; arch=Win32NT; version=4.0.1.0) ZUMO-API-VERSION: 2.0.0 }}
Request.Header {X-ZUMO-FEATURES: TT X-ZUMO-INSTALLATION-ID: 7a813fc5-f5cd-47ce-97a2-9b388cb3e159 Accept: application/json User-Agent: ZUMO/4.0 (lang=Managed; os=Windows; os_version=6.2.0.9200; arch=Win32NT; version=4.0.1.0) X-ZUMO-VERSION: ZUMO/4.0 (lang=Managed; os=Windows; os_version=6.2.0.9200; arch=Win32NT; version=4.0.1.0) ZUMO-API-VERSION: 2.0.0 }
Request.URI {https://....azurewebsites.net/tables/TeguUsers?$filter=((((((M1Mac1 eq '####') or (M1Mac2 eq '####')) or (M2Mac1 eq '####')) or (M2Mac2 eq 'F0761C70A89B')) or (M3Mac1 eq '####')) or (M3Mac2 eq '####'))&$top=1}
Response {StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Date: Fri, 20 Oct 2017 11:14:25 GMT Set-Cookie: ARRAffinity=3fb8a85fa49f4f848d3e147fa888c4fd566bdbdf451e7fccb0737b58d905c69c;Path=/;HttpOnly;Domain=....azurewebsites.net Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Content-Length: 0 }}
StackTrace
" at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__24.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__26.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__18.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.d__20.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.d__18.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider.d__81.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider.<Execute>d__7
1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQuery1.<ToListAsync>d__33.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()\r\n at Tegu.Azure.AMS.Table.TeguUsers.MST.d__11.MoveNext() in d:\Visual Studio Projects\TeguSolutions\TeguDev.Azure.AMS.Table.TeguUsers\Azure.AMS.Table.TeguUsers.cs:line 144"