2012-08-22 32 views
5

這是一個後續的問題這一個:Outbound E-mail Profile API: Get list of e-mailaddresses觀衆管理API:RSA密鑰容器不能打開

我正在寫一個簡單的例子來探討受衆羣體管理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

嘗試運行以下命令:

ASPNET_REGIIS -pa「TridionRsaKeyContainer」「User_Name的」

+0

我試過和輸出是這樣的: 添加ACL訪問的RSA密鑰容器... 找不到RSA密鑰容器。 失敗! –

+0

我再次嘗試使用安裝的原始帳戶,現在一切正常。謝謝 –

+0

嗨Kah,我在使用StaticAddressBook時遇到了和你一樣的問題。運行上面的命令後,我註冊了管理員和mtsuser,但錯誤未解決。我的代碼在頁面加載功能。我是否需要爲此添加任何web.config條目?謝謝 – Meenakshi