5

这是对此问题的后续问题: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 密钥容器不存在。

4

1 回答 1

4

尝试运行以下命令:

aspnet_regiis -pa "TridionRsaKeyContainer" "User_Name"

于 2012-08-22T09:03:07.767 回答