0

在我的手机设备上调试时出现错误,但在模拟器上却没有。每次从服务器(使用 IIS Express 使用 WCF/Odata 托管)请求数据时,它似乎都会出错。相关代码如下(请注意,所有数据访问都会出现问题):

public void LoadData()
    {
        IsDataLoaded = false;

        string queryUri = string.Format("Jobs?$filter=ApplicantID eq {0}", 1);
        jobData.LoadAsync(new Uri(queryUri, UriKind.Relative));
        jobData.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(jobData_LoadCompleted);
    }

    void jobData_LoadCompleted(object sender, LoadCompletedEventArgs e)
    {
        if (e.Error != null)
        {
            MessageBox.Show(e.Error.Message);
        }
        else
        {
            if (jobData.Continuation != null)
            {
                jobData.LoadNextPartialSetAsync();
            }
        }

        IsDataLoaded = true;
    }

当我使用模拟器时,一切正常,但是当我使用我的 WP7 设备时,我收到一个很大的错误:处理此请求时发生错误

更好的是,内部异常只是说 NotFound。

甚至堆栈跟踪也没有那么有用:

 at System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult)
 at System.Data.Services.Client.QueryResult.EndExecute[TElement](Object source, IAsyncResult asyncResult)
 at System.Data.Services.Client.DataServiceRequest.EndExecute[TElement](Object source, DataServiceContext context, IAsyncResult asyncResult)
 at System.Data.Services.Client.DataServiceContext.EndExecute[TElement](IAsyncResult asyncResult)
 at System.Data.Services.Client.DataServiceCollection`1.<>c__DisplayClass6.<LoadAsync>b__5(IAsyncResult asyncResult)
 at System.Data.Services.Client.DataServiceCollection`1.<>c__DisplayClass11.<>c__DisplayClass13.<BeginLoadAsyncOperation>b__f()
 at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
 at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
 at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
 at System.Delegate.DynamicInvokeOne(Object[] args)
 at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
 at System.Delegate.DynamicInvoke(Object[] args)
 at System.Windows.Threading.DispatcherOperation.Invoke()
 at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
 at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
 at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
 at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
 at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

以前有没有人遇到过这个问题并解决了?

4

0 回答 0