I am making an application that basically just needs to send a piece of XML to the server and return. I am having problems, however, in order for this to work and get 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();
success = true;
} catch { }
return success;
}
The server I am sending the message 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 option of an internet client in my application. I can access my local network and the Internet with other store apps. I can access the resource in firefox to get the correct behavior. I do not have a firewall or antivirus that would block these ports
What can cause this unclear error? How can i fix this?