[Solved] Why does this code hang on reaching the first ReadLine from a StreamReader?


I think you should return to basics:

public static string SendXMLFile(string xmlFilepath, string uri, int timeout)
{
    using (var client = new WebClient())
    {                
        client.Headers.Add("Content-Type", "application/xml");                
        byte[] response = client.UploadFile(uri, "POST", xmlFilepath);
        return Encoding.ASCII.GetString(response);
    }
}

and see what works and what the server thinks of your file.

When you really need a TimeOut then see this answer

5

solved Why does this code hang on reaching the first ReadLine from a StreamReader?