MobileServiceInvalidOperationException, Wenn Sie Versuchen Zum Abrufen Von Daten Aus Azure

Dies ist die Methode, die ich verwende.

try
{
    List<Patient> pList = await App.MobileService.GetTable<Patient>().Where(
                patient => patient.id == 1).ToListAsync();
    foreach (Patient p in pList)
    {
        System.Diagnostics.Debug.WriteLine("{0}, {1}", p.id, p.first_name);
    }
}
catch (Exception err)
{
    System.Diagnostics.Debug.WriteLine("ERROR! : {0}", err.Message);
}

Hier ist der Patient-Entität.

class Patient
{
    public int id { get; set; }
    public string first_name { get; set; }
    public string last_name { get; set; }
    public string middle_name { get; set; }
    public string nirc { get; set; }
    public int bed_id { get; set; }
}

Hier ist die Fehlermeldung die ich erhalte.

An exception of type 'System.Net.WebException' occurred in System.Windows.ni.dll and     wasn't handled before a managed/native boundary
An exception of type 'System.Net.WebException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Net.WebException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.DLL and wasn't handled before a managed/native boundary
An exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in Microsoft.Azure.Zumo.WindowsPhone8.Managed.DLL and wasn't handled before a managed/native boundary
An exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in mscorlib.ni.dll
An exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary

Wenn ich wickle meine Methode innerhalb eines TryCatch, bekomme ich diese Meldung

Error : The request could not be completed.  ()

Hier ist der stack Fehlermeldung

    at Microsoft.WindowsAzure.MobileServices.MobileServiceClient.CreateMobileServiceException(String errorMessage, IServiceFilterRequest request, IServiceFilterResponse response)
    at Microsoft.WindowsAzure.MobileServices.MobileServiceClient.ThrowInvalidResponse(IServiceFilterRequest request, IServiceFilterResponse response, JToken body)
    at Microsoft.WindowsAzure.MobileServices.MobileServiceClient.<RequestAsync>d__f.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.<SendReadAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at Microsoft.WindowsAzure.MobileServices.MobileServiceTable`1.<EvaluateQueryAsync>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at Microsoft.WindowsAzure.MobileServices.MobileServiceTableQuery`1.<ToListAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at PhoneApp1.MainPage.<populate>d__0.MoveNext()

Einige Punkte zu beachten.

  1. - Berechtigung gesetzt ist Anybody with the Application Key
  2. Die ich Hinzugefügt habe, Verweis auf Windows Azure Mobile Services Managed Client
  3. Habe ich bereits eingefügt, diesen code in der App.XAML.CS. using Microsoft.WindowsAzure.MobileServices;
  4. Habe ich schon gelegt, dieses Stück code erworben diesem website innerhalb der App.XAML.CS.

    public static MobileServiceClient MobileService = new MobileServiceClient( AppUrl, AppKey );

Warum kann ich keine Verbindung zu meiner Datenbank? Ich habe versucht, läuft diese codes auf einer Windows Store-Anwendung, und es funktionierte. Früher hab ich exakt genauso gemacht und es funktionierte auch.

InformationsquelleAutor Jieqin | 2013-06-04
Schreibe einen Kommentar