WCF-未处理TargetInvocationException异常

WCF-未处理TargetInvocationException异常,wcf,synchronization,smartclient,Wcf,Synchronization,Smartclient,我正在尝试创建WCF以将我的移动设备与服务器同步。当我尝试单击“同步”按钮时,它会引发TargetException异常。下面是Sync()方法 代码 谢谢。我重新创建了Web服务,现在它可以正常工作了。问题是移动设备找不到我的本地Web服务。谢谢。错误信息是什么,发生在哪一行?你试过什么?将错误消息放在您最喜欢的搜索引擎中,并显示您找到但不起作用的解决方案。错误:System.Reflection.TargetInvocationException未经处理消息=“TargetInvocatio

我正在尝试创建WCF以将我的移动设备与服务器同步。当我尝试单击“同步”按钮时,它会引发TargetException异常。下面是Sync()方法

代码


谢谢。

我重新创建了Web服务,现在它可以正常工作了。问题是移动设备找不到我的本地Web服务。谢谢。

错误信息是什么,发生在哪一行?你试过什么?将错误消息放在您最喜欢的搜索引擎中,并显示您找到但不起作用的解决方案。错误:System.Reflection.TargetInvocationException未经处理消息=“TargetInvocationException”/InnerException:System.Net.WebException消息=“无法连接到远程服务器”我说:“将错误消息放在你最喜欢的搜索引擎中,并显示你找到的解决方案,但不起作用。”,而不是“在此处转储错误”。错误“无法连接到远程服务器”在Google上的点击率为615.000,那里肯定有一些有用的东西。例如,你检查过防火墙吗?
            Cursor.Current = Cursors.WaitCursor;
            CustomerProxy.CustomerCacheSyncService svcProxy = new CustomerProxy.CustomerCacheSyncService();
            Microsoft.Synchronization.Data.ServerSyncProviderProxy syncProxy =
                new Microsoft.Synchronization.Data.ServerSyncProviderProxy(svcProxy);

            // Call SyncAgent.Synchronize() to initiate the synchronization process.
            // Synchronization only updates the local database, not your project's data source.
            CustomerCacheSyncAgent syncAgent = new CustomerCacheSyncAgent();
            syncAgent.RemoteProvider = syncProxy;
             /*throws error below code*/
            Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();

            // TODO: Reload your project data source from the local database (for example, call the TableAdapter.Fill method).
            customer_ConfirmationTableAdapter.Fill(testHHDataSet.Customer_Confirmation);

            // Show synchronization statistics
            MessageBox.Show("Changes downloaded: " + syncStats.TotalChangesDownloaded.ToString()
                + "\r\nChanges Uploaded: " + syncStats.TotalChangesUploaded.ToString());

            Cursor.Current = Cursors.Default;