受众管理API:无法打开RSA密钥容器

时间:2012-08-22 08:25:42

标签: tridion tridion-2011

这是对此问题的跟进问题:Outbound E-mail Profile API: Get list of e-mailaddresses

我正在编写一个简单的示例来探索Audience Management API。我所有的代码都在这里。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tridion.AudienceManagement.API;

namespace OEPasswordEncrypt
{
    class Program
    {
        static void Main(string[] args)
        {
            StaticAddressBook importAddressBook = new StaticAddressBook(new UserContext());
        }
    }
}

我在CM服务器上运行时遇到的错误是:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Tridion.AudienceManagement.DomainModel.Utilities.Configuration' threw an exception. ---> Tridion.AudienceManagement.DomainModel.Exceptions.LocalizableConfiguationErrorsException: Loading of the configuration failed. ---> System.Configuration.ConfigurationErrorsException: The RSA key container could not be opened.
   at System.Configuration.RsaProtectedConfigurationProvider.ThrowBetterException(Boolean keyMustExist)
   at System.Configuration.RsaProtectedConfigurationProvider.GetCryptoServiceProvider(Boolean exportable, Boolean keyMustExist)
   at System.Configuration.RsaProtectedConfigurationProvider.Decrypt(XmlNode encryptedNode)
   at Tridion.AudienceManagement.DomainModel.Utilities.ConfigurationEncryption.TraverseAndProcessChildren(Dictionary`2 protectedConfigurationProviders, XmlNodenode)
   at Tridion.AudienceManagement.DomainModel.Utilities.ConfigurationEncryption.DecryptConfiguration(XmlDocument rawConfiguration)
   at Tridion.AudienceManagement.DomainModel.Utilities.Configuration.Reload()
   --- End of inner exception stack trace ---
   at Tridion.AudienceManagement.DomainModel.Utilities.Configuration.Reload()
   at Tridion.AudienceManagement.DomainModel.Utilities.Configuration..cctor()
   --- End of inner exception stack trace ---
   at Tridion.AudienceManagement.DomainModel.Utilities.Configuration.get_LogFolder()
   at Tridion.AudienceManagement.DomainModel.Utilities.Logger.AssertValidLogFolder()
   at Tridion.AudienceManagement.DomainModel.Utilities.Logger.WriteLine(LogLevel logLevel, String message, Object[] objects)
   at Tridion.AudienceManagement.DomainModel.Utilities.Logger.WriteLine(LogLevel logLevel, String message)
   at Tridion.AudienceManagement.DomainModel.Utilities.Logger.Info(String message)
   at Tridion.AudienceManagement.DomainModel.ServiceClient.ContentManagerClient.LogBindingInfo(Exception ex)
   at Tridion.AudienceManagement.DomainModel.ServiceClient.ContentManagerClient.GetConfiguredCoreService()
   at Tridion.AudienceManagement.DomainModel.ServiceClient.ContentManagerClient.GetClient(UserContext userContext, UserData& userData)
   at Tridion.AudienceManagement.DomainModel.ServiceClient.ContentManagerClient.LoadCurrentUser(UserContext userContext, String userDataXml)
   at Tridion.AudienceManagement.DomainModel.UserContext..ctor(String trusteeName)
   at Tridion.AudienceManagement.DomainModel.UserContext..ctor()
   at Tridion.AudienceManagement.API.UserContext..ctor()
   at OEPasswordEncrypt.Program.Main(String[] args) in c:\users\kaht\documents\visual studio 2010\Projects\OEPasswordEncrypt\OEPasswordEncrypt\Program.cs:line 13

我已经尝试使用自己的用户名运行aspnet_regiis TridionRsaKeyContainer,但这告诉我RSA密钥容器不存在。

1 个答案:

答案 0 :(得分:4)

尝试运行以下命令:

aspnet_regiis -pa“TridionRsaKeyContainer”“User_Name”