我要使用适用于WP7的后台传输服务下载文件,但问题有时是我的应用程序崩溃,原因仍然不明原因,当我再次尝试启动它时,它会再次崩溃并出现以下错误。
System.UriFormatException未处理Message = Invalid URI:The 无法确定URI的格式。 StackTrace:at System.Uri.CreateThis(String uri,Boolean dontEscape,UriKind uriKind) 在System.Uri..ctor(String uriString)at Microsoft.Phone.BackgroundTransfer.BtsApi.QueryBackgroundTransferRequestTransferParameters(BtsRequestHandle requestHandle)at Microsoft.Phone.BackgroundTransfer.BackgroundTransferRequest..ctor(BtsRequestHandle requestHandle,String requestId,RequestStatus requestStatus)at Microsoft.Phone.BackgroundTransfer.BackgroundTransferService.BackgroundTransferRequestsEnumerator.MoveNext() 在Transffr.MainPage.InitialTansferStatusCheck()at Transffr.MainPage.OnNavigatedTo(NavigationEventArgs e)at Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs 吃 System.Windows.Navigation.NavigationService.RaiseNavigated(对象 content,Uri uri,NavigationMode模式,Boolean isNavigationInitiator, PhoneApplicationPage existingContentPage,PhoneApplicationPage newContentPage)at System.Windows.Navigation.NavigationService.CompleteNavigation(DependencyObject的 内容,NavigationMode模式)at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult的 结果)在 System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback的 userCallback,PageResourceContentLoaderAsyncResult result)at System.Windows.Navigation.PageResourceContentLoader<> C_ DisplayClass4.b _0(对象 args)at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi,Object obj,BindingFlags invokeAttr,Binder binder,Object 参数,CultureInfo文化,布尔isBinderDefault,汇编 调用者,布尔验证访问,StackCrawlMark& stackMark)at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr,Binder binder,Object []参数, CultureInfo culture,StackCrawlMark& stackMark)at System.Reflection.MethodBase.Invoke(Object obj,Object []参数)
在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 System.Windows.Threading.Dispatcher.OnInvoke(Object。的优先级) System.Windows.Hosting.CallbackCookie.Invoke(Object []上下文) args)at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object [] args)
在System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle,Int32 nParamCount,ScriptParam [] pParams,ScriptParam& pResult)
我不明白,因为在这行代码中:
if (TransferListBox.Items.Count > 0)
{
//Some code here
}
我正在尝试计算列表项,为什么它会告诉我无效的URI?
并且始终使用有效的绝对URL崩溃。
感谢您的帮助。