我在我的Windows Phone应用程序中调用Web服务,但由于某种原因,我随机得到以下错误。另外值得一提的是,我只能通过应用程序获得此功能。当我在浏览器中运行完全相同的Web服务调用时,一切都运行良好。
“System.Net.WebException:远程服务器在System.Net.Browser.ClientHttpWebRequest上的System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)\ r \ n \ n中返回错误:NotFound。\ r \ n。 <> c_ DisplayClass2.b _1(Object sendState)\ r \ n在System.Net.Browser.AsyncHelper。<> c_ DisplayClass4.b _0( System.Reflection.RuntimeMethodInfo.InternalInvoke中的Object sendState)\ r \ n(RuntimeMethodInfo rtmi,Object obj,BindingFlags invokeAttr,Binder binder,Object parameters,CultureInfo culture,Boolean isBinderDefault,Assembly caller,Boolean verifyAccess,StackCrawlMark& stackMark)\ r \ n在System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,BindingFlags invokeAttr,Binder binder,Object []参数,CultureInfo文化,StackCrawlMark& stackMark)\ r \ n在System.Reflection.MethodBase.Invoke(Object obj,Object []参数)\ r \ n在System.MulticastDelegate.Dy的System.Delegate.DynamicInvokeOne(Object [] args)\ r \ n System.Windows.Threading.Dispatcher的System.Delegate.DynamicInvoke(Object [] args)\ r \ n中的namicInvokeImpl(Object [] args)\ r \ n。<> c_ DisplayClass4.b _3()\ r \ n在System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi,Object obj,BindingFlags invokeAttr,Binder binder,Object parameters,CultureInfo culture,Boolean isBinderDefault,Assembly caller,Boolean verifyAccess,StackCrawlMark& stackRark)\ r \ n在System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,BindingFlags invokeAttr,Binder binder,Object []参数,CultureInfo文化,StackCrawlMark& stackMark)\ r \ n在System.Reflection.MethodBase.Invoke(Object System.Delegate.DynamicInvoke上的System.MulticastDelegate.DynamicInvokeImpl(Object [] args)\ r \ n中的System.Delegate.DynamicInvokeOne(Object [] args)\ r \ n的obj,Object []参数)\ r \ n( System.Windows.Threading上的System.Windows.Threading.DispatcherOperation.Invoke()\ r \ n在System.Windows.Threading的System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)\ r \ n中的对象[] args)\ r \ n。 Dispatcher.OnInvoke(对象上下文)\ r \ n在System.Windows.Hosting.CallbackCookie.Invoke(Object [] args)\ r \ n在System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object [] args)\ r \在System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle,Int32 nParamCount,ScriptParam [] pParams,ScriptParam& pResult)\ r \ n“
public void detailsWebService(bool isLastListing, string sessionID, Result listing, DownloadStringCompletedEventHandler callback)
{
//Url to result servlet
string servletUrl = string.Format(baseURL + "Something/patient?sid={0}&patientGuid={1}&format=JSON",
Uri.EscapeDataString(sessionID),
Uri.EscapeDataString(listing.GUID));
//Calls Servlet
WebClient client = new WebClient();
client.DownloadStringCompleted += callback;
client.DownloadStringAsync(new Uri(servletUrl, UriKind.Absolute), patientGuidAndLastListing);
}
如果有人能帮助我,我将不胜感激!感谢..