2012-12-28 18 views
0

我正在做一個WPF應用程序,其中的應用程序需要從web服務抓取數據。這些應用程序可以在我的視覺工作室中運行,但需要超過5秒才能抓取數據。但是,在我發佈它並嘗試在另一臺PC上後,只要點擊搜索按鈕,應用程序就會崩潰。我是否需要執行try catch & catch方法?有什麼建議?WPF在從webservice抓取數據時崩潰

的搜索按鈕的代碼片段:

private void serachBtn_Click(object sender, RoutedEventArgs e) 
{ 
    StoreApi.WebService myApi = new StoreApi.WebService(); 
    var dbs = myApi.GetStorageInfo(0); 
    var query = from p in dbs 
       select new 
       { 
        Name = p.ProductName, 
        Price = p.ProductPrice,      
       }; 

    myProductDataGrid.ItemsSource = query; 
} 

墜毀節目的圖象:

enter image description here

問題詳細信息:

Problem Event Name: CLR20r3 
    Problem Signature 01: beaconproject.exe 
    Problem Signature 02: 1.0.0.0 
    Problem Signature 03: 50dc1b77 
    Problem Signature 04: mscorlib 
    Problem Signature 05: 4.0.30319.17929 
    Problem Signature 06: 4ffa561c 
    Problem Signature 07: 2f1a 
    Problem Signature 08: 23 
    Problem Signature 09: System.FormatException 
    OS Version: 6.1.7601.2.1.0.256.4 
    Locale ID: 1033 
    Additional Information 1: 0a9e 
    Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 
    Additional Information 3: 0a9e 
    Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 
    Read our privacy statement online: 
    http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 
+0

不確定這裏的問題是什麼,在這種情況下「衝突」是什麼意思? –

+0

崩潰或衝突?如果衝突你是什麼意思? –

+0

對不起... *崩潰 – 0070

回答

0

儘量保持一個錯誤日誌,其記錄代碼中的每一步。可以是一個txt文件。在每行執行後修補狀態。更好地嘗試抓住。所以你可以獲得更多的細節以及你的錯誤。