在 Amazon S3 放置请求 (request.AddHeader) 上设置过期标头时 AppHarbor 构建错误
将 .NET Amazon SDK 添加到我的项目中,并且能够在我的本地服务器和 AppHarbor< 上毫无问题地将图像上传到 Amazon S3 /a>.
然后我添加了这一行来设置上传到 S3 时的过期标头:
request.AddHeader("Expires", DateTime.Now.AddYears(10).ToString("r"));
这在我的本地服务器上运行得很好,在 S3 上正确设置了 Expires 标头。
但是当我将此代码推送到 AppHarbor 时,出现以下构建错误:
error CS1061: 'Amazon.S3.Model.PutObjectRequest' does not contain a definition for
'AddHeader' and no extension method 'AddHeader' accepting a first argument of type
'Amazon.S3.Model.PutObjectRequest' could be found (are you missing a using directive or
an assembly reference?)
非常感谢您的帮助!
Added .NET Amazon SDK to my project, and was able to upload images to Amazon S3 with no problems, both on my local server and AppHarbor.
Then I added this line to set the expiration header on upload to S3:
request.AddHeader("Expires", DateTime.Now.AddYears(10).ToString("r"));
This works just fine from my local server, correctly setting the Expires header on S3.
But when I push this code to AppHarbor, I get the following build error:
error CS1061: 'Amazon.S3.Model.PutObjectRequest' does not contain a definition for
'AddHeader' and no extension method 'AddHeader' accepting a first argument of type
'Amazon.S3.Model.PutObjectRequest' could be found (are you missing a using directive or
an assembly reference?)
Thanks very much for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该尝试下载 AppHarbor 构建输出并在本地 IIS 中运行,以验证引用是否有效以及是否更正 AWS SDK 版本。
You should try downloading the AppHarbor build output and run in a local IIS to verify that references work and are to correct AWS SDK versions.