C# 使用伦敦帐户使用openstack.net API云文件进行身份验证
当我使用:C# 使用伦敦帐户使用openstack.net API云文件进行身份验证,c#,openstack,rackspace-cloud,C#,Openstack,Rackspace Cloud,当我使用: CloudIdentity identity = new CloudIdentity() { Username = "files.user", APIKey = "pswd", }; var _storage = new CloudFilesProvider(identity); 身份验证失败。我认为
CloudIdentity identity =
new CloudIdentity()
{
Username = "files.user",
APIKey = "pswd",
};
var _storage = new CloudFilesProvider(identity);
身份验证失败。我认为问题在于我有一个LON帐户,默认的身份验证目标是US cloud实例。在openstack.NETWiki上,我看到了下面的示例
IIdentityProvider identityProvider = new CloudIdentityProvider();
var userAccess = identityProvider.Authenticate(new RackspaceCloudIdentity{
Username = "MyUserName",
Password = "MyPassword",
CloudInstance =CloudInstance.UK});
在最新版本的库中,RackspaceCloudIdentity具有域参数,而不是CloudInstance。我想这个例子已经过时了
如何使用域参数?还是有更好的方法通过LON cloud实例进行身份验证?Rackspace现在使用全局身份验证,因此美国和英国帐户之间的唯一区别是您传入的凭据。如果身份验证失败,则可能出现以下问题之一:
CloudIdentity
实例的用户名和/或API密钥不正确我也看到了同样的错误。我相信这与通过UI创建的子帐户有关。他们没有正确设置DefaultRegion(为空)
解决此问题的唯一方法是使用父帐户,或者在每次API调用时手动设置区域。Hi。我发现了问题。这是关于我使用的用户帐户。我创建这个帐户只是为了访问云文件。我可以在用户管理面板上看到,该用户有权“查看、创建、编辑、删除”产品“文件”。但是,当我尝试在代码中验证该用户时,会出现以下异常:“该用户无权访问请求的服务或区域”。我在我的主要用户身上尝试了相同的代码,而且效果很好。有什么建议吗?