訪問的桉樹海象(S3)我已經下載了亞馬遜AWS SDK爲C#,我沒有問題,訪問我們的運行桉樹私有云EC2的一部分,我可以列出,圖片,實例,區...如何使用Amazon AWS SDK爲C#
這是工作的罰款:
AmazonEC2 ec2 = AWSClientFactory.CreateAmazonEC2Client("abcdefghijklmnopqrstuvwxyz1234567890", "abcdefghijklmnopqrstuvwxyz1234567890", new AmazonEC2Config().WithServiceURL("http://10.140.54.12:8773/services/Eucalyptus"));
DescribeInstancesRequest ec2Request = new DescribeInstancesRequest();
try
{
DescribeInstancesResponse ec2Response = ec2.DescribeInstances(ec2Request);
int numInstances = 0;
numInstances = ec2Response.DescribeInstancesResult.Reservation.Count;
textBoxInstancesLog.AppendText("You have " + numInstances + " running instances");
textBoxInstancesLog.AppendText(ec2Response.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
但我需要訪問我們的雲的海象(S3)的一部分。這是我如何嘗試訪問Walrus,代碼幾乎完全相同,但通過這個調用,我會得到一個異常。
這不是工作:
AmazonS3 s3 = AWSClientFactory.CreateAmazonS3Client("abcdefghijklmnopqrstuvwxyz1234567890", "abcdefghijklmnopqrstuvwxyz1234567890", new AmazonS3Config().WithServiceURL("http://10.140.54.12:8773/services/Walrus"));
ListBucketsRequest s3Request = new ListBucketsRequest();
try
{
ListBucketsResponse s3Response = s3.ListBuckets(s3Request);
textBoxS3Log.AppendText(s3Response.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
我會收到此異常:
System.Net.WebException: The remote name could not be resolved: 'http'
at Amazon.S3.AmazonS3Client.processRequestError(String actionName, HttpWebRequest request, WebException we, HttpWebResponse errorResponse, String requestAddr, WebHeaderCollection& respHdrs, Type t, Exception& cause)
at Amazon.S3.AmazonS3Client.handleHttpWebErrorResponse(S3Request userRequest, WebException we, HttpWebRequest request, HttpWebResponse httpResponse, Exception& cause, HttpStatusCode& statusCode)
at Amazon.S3.AmazonS3Client.getResponseCallback[T](IAsyncResult result)
at Amazon.S3.AmazonS3Client.endOperation[T](IAsyncResult result)
at Amazon.S3.AmazonS3Client.ListBuckets(ListBucketsRequest request)
at IAASClient.FormMain.buttonS3Test_Click(Object sender, EventArgs e) in X:\work\IAASClient\FormMain.cs:line 107
桉樹網站:
桉樹實現了IaaS的 (紅外結構即服務)的私有云 ,其經API 與Amazon EC2和Amazon S3 兼容可訪問
我缺少什麼?
注:與亞馬遜S3相同的代碼工作完美無缺,問題是訪問桉樹海象。
「Eucalyptus Walrus」將成爲樂隊的好名字。 (對不起,我不能用的問題有所幫助,但是!) – ewall 2011-06-08 17:33:28