Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Xamarin.iOS - consuming a WCF service hosted locally results in timeout

$
0
0

First of all, this problem does NOT occur when I access the same WCF service hosted on my Azure account. The problem only occurs when hosting locally.

The WCF service is hosted on my local IIS account. I've successfully tested it using this C# code in a WinForms app:

        ServiceReference1.myService client = new ServiceReference1.myServiceClient();
        var response = client.Authenticate("xxxx", "yyyy");
        client.Close();

In my Xamarin.iOS app (using Visual Studio 2017 on a Windows 10 machine connected to a Mac), I have my local .cs file created using slsvcutil. I also have a proxy class that looks like this:

        public class WCFClientProxyFactory
        {
            //private static readonly EndpointAddress _Endpoint = new EndpointAddress("http://192.168.85.1/myService.svc");
            private static readonly EndpointAddress _Endpoint = new EndpointAddress(_my azure url_);

            public static myServiceClient CreateWCFClientProxy()
            {
                myServiceClient client;
                BasicHttpBinding binding = CreateBasicHttp();
                client = new myServiceClient(binding, _Endpoint);
                return client;
            }

            private static BasicHttpBinding CreateBasicHttp()
            {
                BasicHttpBinding binding = new BasicHttpBinding
                {
                    Name = "basicHttpBinding", MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647
                };
                TimeSpan timeout = new TimeSpan(0, 0, 30);
                binding.SendTimeout = timeout;
                binding.OpenTimeout = timeout;
                binding.ReceiveTimeout = timeout;
                return binding;
            }
        }

Everything works if the azure Endpoint is used. If I use the local url, I get this error:

{System.TimeoutException: The operation has timed out. at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_delegate_end_invoke(object,intptr) at (wrapper delegate-end-invoke) .end_invoke_object__this___object[]&_IAsyncResult(object[]&,System.IAsyncResult).......... (_it goes on for a while_)

I've tried turning off my Windows firewall since the request is coming from an external source (Mac). But no change.

Any help is appreciated...


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>