0

"Dynamics CRM Online" で連絡先が作成されたときに、データを Azure Service Bus Queue にプッシュしようとしています。Plugin Registration Tool に登録することにより、プラグインを使用して実装しました。しかし、どういうわけか、連絡先の保存中にエラーがスローされます。プラグインに実装したコードは次のとおりです。

public void Execute(IServiceProvider serviceProvider)
    {
        try
        {                
            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            Entity entity = (Entity)context.InputParameters["Target"];
            if (entity.LogicalName.Equals("account"))
            {
                QueueDescription qd = new QueueDescription("testQ");

                qd.MaxSizeInMegabytes = 5120;
                qd.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0);

                string connectionString =
                    CloudConfigurationManager.GetSetting("Endpoint=sb://test.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=secretcode=");

                var namespaceManager =
                    NamespaceManager.CreateFromConnectionString(connectionString);
                if (!namespaceManager.QueueExists("testQ"))
                {
                    namespaceManager.CreateQueue("testQ");
                }

                QueueClient Client =
                    QueueClient.CreateFromConnectionString(connectionString, "testQ");

                BrokeredMessage message = new BrokeredMessage(entity);

                message.Properties["FirstName"] = "ABC";
                message.Properties["LastName"] = "Z";

                Client.Send(message);
            }
        }
        catch (Exception e)
        {
            throw;
        }
}
4

2 に答える 2

0

DLL をどのように参照していますか? (GAC ではなく) ローカル参照を追加する必要があります。例: C:\Program Files (x86)\Windows Azure platform AppFabric SDK\V1.0\Assemblies\NET4.0\Microsoft.ServiceBus.dll

また、"Copy Local" を true に設定して、アセンブリがプラグインと共にパッケージ化されるようにします。

于 2013-10-28T14:04:44.473 に答える
0

Dynamics CRM 2013 SDKの例を確認\SDK\SampleCode\CS\Azure する必要があります。更新されていない場合は、Fall '13 リリースにアップグレードされていることを前提として、Dynamics CRM 2011 SDKの同じ場所を確認する必要があります。そのままでは機能しませんが、サポートされている方法を使用してすべての要件を満たすことができます。

Dynamics CRM にある Azure プラグイン機能を使用する必要があります。詳細を追加しますが、長すぎるため、写真と一緒に読むのが最適です。 -dynamics-crm-step-by-step.aspx

于 2013-12-06T22:35:48.630 に答える