问题:
利用PutObjec上传本地的一个272KB文件,调用时IE一直在Loading,然后报
操作超时异常。
根据SDK文档编写的代码 :
try
{
//上图片到阿里云
String accessId = "******";
String accessKey = "******";
String endPoint = "http://oss-cn-beijing.aliyuncs.com";
OssClient ossClient = new OssClient(endPoint, accessId, accessKey);
using (var fs = File.Open("d:\\a.jpg", FileMode.Open))
{
// 可以设定自定义的metadata。
ObjectMetadata metadata = new ObjectMetadata();
metadata.ContentLength = fs.Length;
metadata.ContentType = "image/jpeg";
ossClient.PutObject("fires", "thum/original/2014/5/a.jpg", fs, metadata);
}
}
catch (OssException ex)
{
}
根据快速入门手册的编写的
代码:
FileStream fs = File.Open("D:\\20140530100839140.jpg", FileMode.Open);
// 可以设定自定义的metadata。
ObjectMetadata metadata = new ObjectMetadata();
//metadata.ContentLength = fs.Length;
//metadata.ContentType = "image/jpeg";
metadata.UserMetadata.Add("myfield","test");
PutObjectResult result = client.PutObject(bucket, "20140530100839140.jpg", fs, metadata);
异常:
[WebException: 操作超时]
Aliyun.OpenServices.Common.Communication.RetryableServiceClient.SendImpl(ServiceRequest request, ExecutionContext context, Int32 retries) in d:\Work\API\openapi\dotnet\aliyunapi\Common\Communication\RetryableServiceClient.cs:82
Aliyun.OpenServices.Common.Communication.RetryableServiceClient.Send(ServiceRequest request, ExecutionContext context) in d:\Work\API\openapi\dotnet\aliyunapi\Common\Communication\RetryableServiceClient.cs:54
Aliyun.OpenServices.OpenStorageService.Commands.OssCommand.Execute() in d:\Work\API\openapi\dotnet\aliyunapi\OpenStorageService\Commands\OssCommand.cs:76
Aliyun.OpenServices.OpenStorageService.Commands.OssCommand`1.Execute() in d:\Work\API\openapi\dotnet\aliyunapi\OpenStorageService\Commands\OssCommand.cs:125
Aliyun.OpenServices.OpenStorageService.OssClient.PutObject(String bucketName, String key, Stream content, ObjectMetadata metadata) in d:\Work\API\openapi\dotnet\aliyunapi\OpenStorageService\OssClient.cs:319
PhotoAlbum.ProcessPhoto(String originalImagePath, String thumbnailPath, Int32 width, Int32 height) in D:\Project\FitGpsServer\FitGpsServer\PhotoAlbum.ascx.cs:500
PhotoAlbum.Page_Load(Object sender, EventArgs e) in D:\Project\FitGpsServer\FitGpsServer\PhotoAlbum.ascx.cs:62
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。