public static TeaResponse DoAction(TeaRequest request, Dictionary <string, object> runtimeOptions) { int timeout; var url = ComposeUrl(request); Uri uri = new Uri(url); HttpRequestMessage req = GetRequestMessage(request, runtimeOptions, out timeout); try { HttpClient httpClient = HttpClientUtils.GetOrAddHttpClient(request.Protocol, uri.Host, uri.Port, runtimeOptions); HttpResponseMessage response = httpClient.SendAsync(req, new CancellationTokenSource(timeout).Token).Result; return(new TeaResponse(response)); } catch (System.Threading.Tasks.TaskCanceledException) { throw new WebException("operation is timeout"); } }