我正在尝试从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.
请帮帮我!
答案 0 :(得分:1)
您应该考虑尝试使用AWS开发工具包的第2版(http://aws.amazon.com/sdkfornet/#version2)。 SDK的第1版使用XSLT for EC2,我之前看到过这会导致这样的权限问题。使用版本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**
}