gpt4 book ai didi

c# - Windows phone 8 CommunicationException 远程服务器返回错误 : NotFound

转载 作者:行者123 更新时间:2023-11-30 22:13:01 25 4
gpt4 key购买 nike

我想问一个让我一直发疯的问题@_@我为 Windows Phone 8 制作了一个应用程序,它从 wcf 服务中检索数据。幸运的是,我的同事让我为此服务。但是,当我使用该服务时,出现了这个错误。

System.ServiceModel.CommunicationException was unhandled by user code
HResult=-2146233087
Message=The remote server returned an error: NotFound.
Source=System.ServiceModel
StackTrace:
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at NavFinance.NavFinData.NavcoreNavfinServiceClient.NavcoreNavfinServiceClientChannel.EndGetAll(IAsyncResult result)
at NavFinance.NavFinData.NavcoreNavfinServiceClient.NavFinance.NavFinData.INavcoreNavfinService.EndGetAll(IAsyncResult result)
at NavFinance.NavFinData.NavcoreNavfinServiceClient.OnEndGetAll(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException: System.Net.WebException
HResult=-2146233079
Message=The remote server returned an error: NotFound.
Source=System.Windows
StackTrace:
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
InnerException: System.Net.WebException
HResult=-2146233079
Message=The remote server returned an error: NotFound.
Source=System.Windows
StackTrace:
at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClasse.<EndGetResponse>b__d(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass1.<BeginOnUI>b__0(Object sendState)
InnerException:

四处搜索后,我找到了这篇好文章。 http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx

但是,我读了它,但仍然不明白。为什么?因为我的服务是用 C# 类编写的,而不是作为 Web 服务编写的。所以我找不到 IIS 服务。

这是我生成数据的代码。

public PurchaseInvoiceMainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(purchaseInvoice_Loaded);
}

private void purchaseInvoice_Loaded(object sender, RoutedEventArgs e)
{
NavcoreNavfinServiceClient client = new NavcoreNavfinServiceClient();
client.GetAllCompleted += new EventHandler<GetAllCompletedEventArgs>(client_getAllPurchaseInvoice);
client.GetAllAsync("509A7214-D3A9-47E7-9BB4-232E670ED650");
}

private void client_getAllPurchaseInvoice(object sender, GetAllCompletedEventArgs e)
{
if (e.Error == null)
{
purchaseDataList.ItemsSource = e.Result;
}
}

而且,这是返回结果的我的服务。

public System.Collections.ObjectModel.ObservableCollection<NavFinance.NavFinData.vwPurchaseInvoice> EndGetAll(System.IAsyncResult result) {
object[] _args = new object[0];
System.Collections.ObjectModel.ObservableCollection<NavFinance.NavFinData.vwPurchaseInvoice> _result = ((System.Collections.ObjectModel.ObservableCollection<NavFinance.NavFinData.vwPurchaseInvoice>)(base.EndInvoke("GetAll", _args, result)));
return _result;
}

我在这一行得到了异常。

System.Collections.ObjectModel.ObservableCollection<NavFinance.NavFinData.vwPurchaseInvoice> _result = ((System.Collections.ObjectModel.ObservableCollection<NavFinance.NavFinData.vwPurchaseInvoice>)(base.EndInvoke("GetAll", _args, result)));

我使用了很多我发现的技巧,从扩大最大字节等开始。它仍然不起作用。有人请帮助我。我真的很困惑TT_TT

这是我使用的服务。

http://dev.navcore.com/NavFinWebService/Navcore.Navfin.Service.NavcoreNavfinService.svc

大家的任何回答都会让我思考更多,请给出答案。

问候,布迪普拉塞蒂奥

最佳答案

此错误表明您的应用程序无法与该服务通信。您是否在电话/模拟器 Internet Explorer 中尝试服务 URL 以确保该 URL 可访问?

关于c# - Windows phone 8 CommunicationException 远程服务器返回错误 : NotFound,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19400490/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com