Question

I want to ask a question that make me crazy all this time @_@ I've made an app for windows phone 8 which retrieve data from wcf service. Luckily, my office mate make me a service for it. But, when I use that service, I got this error.

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:

After Searching here and there, I got this good article. http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx

But, I read it and still don't get it. Why? Because my service is write in C# class, not as a web service. So i can't found the IIS service.

Here is my code to generate my data.

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;
            }
        }

And, here is my service which return the 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;
            }

I got the Exception right on this line.

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

I've used many trick that i found, starting from upsizing the maxbytes, etc. It still does not work. Some one please help me. I really confuse TT_TT

Here is the service that i use.

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

Any answer from all of you will make me think more, please give an answer.

Regards, Budi Prasetyo

Was it helpful?

Solution

This error indicates that your application was unable to communicate with the service. are you try the service URL in the phone/emulator Internet Explorer to be sure the url is accessible?

OTHER TIPS

woah, amazing..!! after 3 days suffering about this error, finally found something. :)

All the credit should be given to Josue Yeray Thanks a lot man, why I am not realize about that erlier. Finally i got my data from my service only by connecting the emulator to the internet.

In my case, usually i used wired connection, and that's not working at all at the emulator. after searching, i change my connection to wireless connection. and then, its working and done.

Thanks a lot. :)

Do nothing Extra, Just go and turn off the Firwall of Public and Private both, then wait for 2-3 mins and then run the App. It will run perfect.

I did and it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top