0

我正在尝试从 Amazon EC2 获取标签:

using (client = Amazon.AWSClientFactory.CreateAmazonEC2Client(accessKeyID, secretAccessKeyID))
{
     DescribeTagsRequest request = new DescribeTagsRequest().WithFilter(
         new Filter().WithName("key").WithValue(new string[] { "domain" }), 
         new Filter().WithName("resource-type").WithValue(new string[] { "instance" }));           

     DescribeTagsResponse responce = client.DescribeTags(request);  //**error**
}

错误文字:

Message: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\Windows\TEMP\03eg1ztl.0.cs' could not be found
error CS2008: No inputs specified

我找到了两个解决方案:授予帐户访问临时目录的权限并将 sgen.exe 用于 AWSSDK.dll

当我尝试将 sgen.exe 用于 AWSSDK.dll 时,出现错误:

Types "Amazon.RDS.Model.VpcSecurityGroupMembership" 
and "Amazon.Redshift.Model.VpcSecurityGroupMembership" 
use the name of the type XML "VpcSecurityGroupMembership" from namespace "". 
Use the attributes of XML, to set the type of a unique name and / or namespace XML.

请帮帮我!

4

1 回答 1

1

您应该考虑尝试 AWS 开发工具包的第 2 版 ( http://aws.amazon.com/sdkfornet/#version2 )。SDK 版本 1 对 EC2 使用 XSLT,我之前已经看到这会导致类似的权限问题。使用版本 2,您的代码将如下所示。

using (client = Amazon.AWSClientFactory.CreateAmazonEC2Client(accessKeyID, secretAccessKeyID))
{
    DescribeTagsRequest request = new DescribeTagsRequest
    {
        Filters = new List<Filter>
        {
            new Filter{ Name = "key", Values = new List<string>{"domain"}},
            new Filter{ Name = "resource-type", Values = new List<string>{"instance"}}
        }
    };

    DescribeTagsResponse responce = client.DescribeTags(request);  //**error**
}
于 2013-11-06T06:28:05.087 回答