URL をパラメーターとして取り、そこから GET 応答を返す関数を作成しようとしていますが、WebResponse responseObject intialization
行にエラーが表示されるだけです
例外はAn exception of type 'System.Net.ProtocolViolationException' occurred in mscorlib.ni.dll but was not handled in user code
public static async Task<string> get(string url)
{
var request = WebRequest.Create(new Uri(url)) as HttpWebRequest;
request.Method = "GET";
request.ContentType = "application/json";
WebResponse responseObject = await Task<WebResponse>.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, request);
var responseStream = responseObject.GetResponseStream();
var sr = new StreamReader(responseStream);
string received = await sr.ReadToEndAsync();
return received;
}