如何在使用C#下载亚马逊s3? [英] How to download amazon s3 in use C#?

查看:270
本文介绍了如何在使用C#下载亚马逊s3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我做了一些研究,以便快速从云中获取数据。

我发现亚马逊s3。我想尝试空的控制台项目并与我的项目集成。



如何解决启动控制台应用程序和编写代码。?





我写这段代码但是不写。如何创建应用程序并编写代码?



< b>我尝试过:



I have one project, and I've done some research to get the data out of the cloud quickly.
And I find amazon s3. I want to experiment with the empty console project and to integrate with my project.

How to solve start console application and write code.?


I write this code but dont write.How to create application and write code?

What I have tried:

using System;
using System.IO;


namespace ConsoleApplication1
{
    
        public partial class AmazonS3
        {
            public object FileUpload1 { get; private set; }
            public object Response { get; private set; }

            protected void Page_Load(object sender, EventArgs e)
            {

            }

            protected void upload(string myBucketName, string accessKey ,
                string secretKey,)
            {
            }

  
                Stream st = FileUpload1.PostedFile.InputStream;

                string name = Path.GetFileName(FileUpload1.FileName);
                string myBucketName = "";
                string accessKey = "";
                string secretKey = "";
                bool a;
                AmazonUploader myUploader = new AmazonUploader();
                a = myUploader.sendMyFileToS3(st, accessKey, secretKey);
                if (a == true)
                {
                    Response.Write("successfully uploaded");

                }
                else
                    Response.Write("Error");
            }
        }



    }

推荐答案

让我们计算一下为什么不能编译的错误;更少运行。



1- protected void Page_Load()表示网络应用程序。

- 如果这是一个控制台应用程序,它将是 static void Main()



2- protected void upload()为空。



3-此类中的实际代码不在一个方法。最好的猜测是它属于上传方法;但这是传递您在此代码中定义的值。 这是编译错误



4-没有引用(例如使用Amazon.S3; ,所以该类不知道新的AmazonUploader()是什么。这也是编译错误
Let us count the errors as to why this will not compile; much less run.

1- protected void Page_Load() is indicative of a web application.
-- If this was a console application it would be static void Main()

2- protected void upload() is empty.

3- The actual code within this class is not within a method. Best guess is it belongs in the upload method; but that is passing in values you are defining in this code. This is a compilation error

4- There are no references (e.g. using Amazon.S3; , so the class will not know what a new AmazonUploader(). This also is a compilation error


这篇关于如何在使用C#下载亚马逊s3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆