2013-06-27 6 views
1

Android 용 Xamarin을 사용 중이며 하늘빛 모바일 서비스 컴포넌트를 추가했습니다.Xamarin MonoAndroid Azure 모바일 서비스 InsertAsync

나는이 같은 모바일 서비스에 연결 (https://github.com/xamarin/azure-mobile-services)

같은 일 목록 응용 프로그램을 만들려고 해요 :

public static string mobileServiceUrl = "http://MyMoblieService.azure-mobile.net/.azure-mobile.net/"; 
public static string mobileServiceAppKey = "MyAppKey"; 

private static readonly MobileServiceClient MobileService = 
      new MobileServiceClient(mobileServiceUrl, mobileServiceAppKey); 

this.adapter = new TodoAdapter(MobileService.GetTable<Item>(), this); 

내가 테이블에 데이터를 삽입 할 adapte 삽입 기능을 사용을

public void Insert(Item item) 
    { 
    IsUpdating = true; 
    this.items.Add(item); 
    NotifyDataSetChanged(); 

    this.table.InsertAsync(item).ContinueWith(t => 
    { 
     if (t.IsFaulted) 
     { 
      this.items.Remove(item); 
      NotifyDataSetChanged(); 
     } 

     IsUpdating = false; 
    }, scheduler); 
} 

하고 매번 내가 t.Exception 발굴 때 나는 Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException을 찾을 debuging 동안 나는 t.IsFaulted = true를 얻을 수

필요한 경우 나머지 코드를 제공하게되어 기쁩니다.

편집 된 예외 수준을 얻을 수있는 유일한 방법은 디버깅하는 동안 감시 창에서 세부 정보를 가져 오는 것입니다. Microsoft.WindowsAzure.MobileServices.ServiceFilterRequest는 "응용 프로그램/JSON"문자열 내용 "{\"텍스트 \ "을 수락 요청 {Microsoft.WindowsAzure.MobileServices.ServiceFilterRequest} - : 요청 & 응답 요청 : 예외는 두 속성이 있습니다 : String " ContentType"application/json "문자열 - 머리글 수가 2입니다. System.Collections.Generic.Dictionary - 항목 {System.Collections.Generic.KeyValuePair [ 2]} System.Collections.Generic.KeyValuePair [] - [0] System.Collections.Generic.KeyValuePair 키 "X-ZUMO-INSTALLATION-ID"문자열 "17b22eec-edd2-4a15-a37f-d4c5d87e4e8e"문자열 + 비공개 회원
- [1] {System.Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair 키 "X-ZUMO-APPLICATION"문자열 값 "FmlVNVhdQhNEAIZZVptKhxlQNuJrlq37"문자열 + 비공개 회원
+ 원시보기
방법 "POST"문자열 - 열린 우리당 {선택 System.Uri} 선택 System.Uri AbsolutePath "/.azure-mobile.net/tables/Item" 문자열 AbsoluteUri 기관 "ichange.azure-mobile.net"문자열 DnsSafeHost "ichange.azure-mobile.net"문자열 Fr agment ""문자열 호스트 "ichange.azure-mobile.net"문자열 HostNameType System.UriHostNameType.Dns System.UriHostNameType IsAbsoluteUri 사실 부울 IsDefaultPort 사실 부울 ISFILE 거짓 부울 이 외에도 isLoopback 거짓 부울 IsUnc 거짓 부울 localPath를 "/ .azure-mobile.net/tables/Item "문자열 원본 문자열
PathAndQuery"/.azure-mobile.순/테이블/상품 "문자열 포트 80 INT 검색어" "문자열 계획"HTTP "문자열 + 세그먼트 {문자열 [4]} 이 거짓 부울 사용자 정보" "문자열을 UserEscaped [] 문자열 + 정적 멤버
+ 비공개 회원
정적 멤버

응답 - 응답 {Microsoft.WindowsAzure.MobileServices.ServiceFilterResponse} Microsoft.WindowsAzure.MobileServices.ServiceFilterResponse 내용 "{\"코드 \ "404 \"오류 \ " : \ "오류 : 찾을 수 없음 \"} "문자열 Conten tType "application/json"문자열 - 머리글 수 = 8 System.Collections.Generic.Dictionary - 항목 {System.Collections.Generic.KeyValuePair [8]} System.Collections.Generic.KeyValuePair [] - [0] { System.Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair 키 "캐시 제어"문자열 값 "노 캐시"문자열 + 비공개 회원
- [1] {System.Collections.Generic. KeyValuePair} System.Collections.Generic.KeyValuePair 키 "콘텐츠 길이"문자열 값 "39"문자열 + 비공개 회원
- [2] {System.Collections.Generic.KeyValuePair} System.Collections.Generic. 애 yValuePair 키 "의 Content-Type"문자열 값 "응용 프로그램/JSON"문자열 + 비공개 회원
- [3] {System.Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair 키 "서버" 문자열 값 "마이크로 소프트 IIS/8.0"문자열 + 비공개 회원
- [4] {System.Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair 키 "설정 - 쿠키를"문자열 값 " ARRAffinity = 3041b7170f63e41156a1ff0b65518583e91f68d4f90a680a7750bd8d12f209e0; 경로 =/도메인 = ichange.a ... "문자열 + 비공개 구성원
- [5] System.Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair 키 "X-ZUMO 버전"문자열 값 "Zumo.Main.0.1.6.3017.Runtime"문자열 + 비공개 회원
- [6 ] {System.Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair 키 "X가 강화 된-하여"문자열 값 "ASP.NET"문자열 + 비공개 회원
- [7] {시스템. Collections.Generic.KeyValuePair} System.Collections.Generic.KeyValuePair Key "Date"문자열 값 "Thu, 2013 년 6 월 27 일 18:23:56 GMT"문자열 + 비공개 멤버
+ Raw V iew
ResponseStatus Microsoft.WindowsAzure.MobileServices.ServiceFilterResponseStatus.ProtocolError Microsoft.WindowsAzure.MobileServices.ServiceFilterResponseStatus 상태 코드 (404) INT 상태 설명 "찾을 수 없음"문자열

+0

예외 객체의 세부 사항은 무엇입니까? – carlosfigueira

+0

@carlosfigueira 세부 사항과 함께 질문을 편집했는데, 응답 404에 나타나지 않는다. –

+0

이것은 이상하게 보인다 :'string mobileServiceUrl = "http : // MyMoblieService.azure-mobile.net/.azure-mobile.net /'- 당신은 올바른 URL을 가지고 계실 거라 확신하십니까? 도메인 이름 뒤에 **./azure-mobile.net/**을 가져야한다는 것이 정말로 의심 스럽습니다 ... – carlosfigueira

답변

1

우리는 코멘트에서 논의 된 바와 같이 : 당신이에 전달하고있는 URL MobileServiceClient 생성자가 잘못되었습니다. '찾을 수 없음'응답을 통해 다음 URL의 URL을 볼 수 있습니다.

public static string mobileServiceUrl = 
    "http://MyMoblieService.azure-mobile.net/.azure-mobile.net/"; 

그리고 올바르지 않습니다.아래와 같이되어야합니다 :

public static string mobileServiceUrl = 
    "http://MyMoblieService.azure-mobile.net/"; 
+0

안녕하세요 카를로스, 모바일 서비스 팀에서 일하는 것을 볼 수 있습니다. : D 시간이 있으면 [이 질문] (http://stackoverflow.com/questions/18411397/loginasync-missing)을 확인해 주시겠습니까? 정말 고마워요! – Marco

관련 문제