WP8 アプリからローカルの asp.net Web API メソッドを呼び出して、例外を取得しています。
asyncResult.AsyncWaitHandle' がタイプ 'System.NotSupportedException' の例外をスローしました
誰でもこれを手伝ってもらえますか?
public void GetProducts()
{
UriBuilder fullUri = new UriBuilder(baseUri + "productapi");
fullUri.Query = "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(fullUri.Uri);
request.Accept = "application/json";
RequestUpdateState requestState = new RequestUpdateState();
requestState.AsyncRequest = request;
request.BeginGetResponse(new AsyncCallback(HandleProductsResponse),
requestState);
}
private void HandleProductsResponse(IAsyncResult asyncResult)
{
// get the state information
RequestUpdateState requestState = (RequestUpdateState)asyncResult.AsyncState;
HttpWebRequest request = (HttpWebRequest)requestState.AsyncRequest;
// end the async request
requestState.AsyncResponse = (HttpWebResponse)request.EndGetResponse(asyncResult);
Stream streamResult;
// get the stream containing the response from the async call
streamResult = requestState.AsyncResponse.GetResponseStream();
ObservableCollection<Product> productList = new ObservableCollection<Product>();
}