I'm making an application which basically just needs to send a piece of XML to a server and return. I'm having trouble however getting this to work and getting very strange errors
public bool Post(string data)
{
string server="http://my-lan-computer:9091/foo"
bool success = false;
HttpClient client = new HttpClient();
try
{
client.PostAsync(server, new StringContent(data, Encoding.UTF8, "text/xml")).Wait(); //error here
success = true;
} catch { }
return success;
}
The server I'm posting to is not localhost, but it is a computer on my local network. I get this error deeply nested:
innerException: {"An error occurred while sending the request."}
innerException: {"Unable to connect to the remote server"}
innerException: {"An attempt was made to access a socket in a way forbidden by its access permissions 123.123.123.123:9091"}
I have the internet client capability on my application. I can access my local network and internet by other store applications. I can access the resource in firefox get proper behavior. I don't have a firewall enabled nor an anti-virus that would block these ports
What could possibly cause this obscure error? How can I fix it?
To access the LAN, you must declare the Private Network
capability in your application manifest. Note that this is different than the Internet
capability.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With