I want to send some data from my computer to my phone in my network using WCF & Xamarin. I haven't found any documentation and need some help getting this to work.
Working with WCF in Xamarin did not really help me since it needs an .svc file.
Is it even possible to connect to an application in the local network from xamarin ?
Sorry if the question seems dumb but im really suck here and got no idea how to solve this.
If any1 could just point me to the right direction i'll be very thankful.
EDIT:
So far I managed to get the .svc
file from my service using SLsvcUtil.exe
.
This is my Service (ServerSide) so far:
System.Net.IPHostEntry entry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
string ipaddress = entry.AddressList.First(add => add.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToString();
using (ServiceHost host = new ServiceHost(typeof(BusyService)))
{
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri($"http://{ipaddress}:8777/BusyService");
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine($"Server started at: {ipaddress}:8777/BusyService");
Console.ReadLine();
}
App.config
<system.serviceModel>
<services>
<service name="ConsoleApplication3.BusyService">
<endpoint address="http://192.168.56.1:8777/BusyService" binding="basicHttpBinding"
bindingConfiguration="" name="DefaultEndpoint" contract="ConsoleApplication3.IBusyService" />
</service>
</services>
</system.serviceModel>
Right now my AndroiApp
is only either throwing a TimeoutEx or EndpointNotFoundEx.
Things I've checked:
- AntiMalware is off
- Port 8777 is free in Firewall
- Server endpoint and client-connnecting-to-endpoint are the same
What can be the issue here ?
Note:
I was getting this Exception earlier but I managed to get rid of it calling _client.OpenAsync()
and invocing my methods in _client_OpenCompleted
- not sure if this is right ... I've not seen any1 opening the client in the above tutorial...