-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
需要所有上传与下载请求都支持Async异步方法 #101
Comments
看了你们是基于HttpWebRequest的..... |
同样需要。 |
三年前就有人提出支持async/await、返回Task的API了…… |
现在正在使用的异步方法。 /// <summary>
/// 获取OSS文件内容
/// </summary>
public async Task<Stream> GetFileContentAsync(string ossKey)
{
var tcs = new TaskCompletionSource<OssObject>();
_ossClient.BeginGetObject(_config.AliyunOSSFileContentBucket,
ossKey,
asyncResult =>
{
var result = _ossClient.EndGetObject(asyncResult);
tcs.SetResult(result);
},
null);
var result = await tcs.Task;
if (result.HttpStatusCode == HttpStatusCode.NotFound)
{
return default(Stream);
}
return result.ResponseStream;
} 这就很蛋疼了//// |
更新:新版OSS SDK可以关注此仓库。底层使用的HttpClient,有纯异步的API。Nuget搜索 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我们正在ASP.NET Core上使用Aliyun OSS SDK,但是发现没有异步上传的方法,能否提供?
The text was updated successfully, but these errors were encountered: