2017-01-19 16 views
3

URLからカスタムパラメータを読み込むプラグインを作成します。crm dynamics online、プラグインにカスタムURLパラメータを渡します。

System.Security.SecurityException:そのアセンブリがない私は、次のエラーを得た私は、このコール

var reference = HttpContext.Current.Request.QueryString["parameter_reference"] 

のためにそれを実装しようとしたコード

https://blogs.msdn.microsoft.com/madenwal/2011/04/15/retrieving-querystring-paramaters-in-a-crm-plug-in/

のこの 作品を見つけました部分的に信頼できる発信者は許可しません。

私はこの記事で示され、アセンブリに属性を適用することによって、この問題を解決しようとした:

https://support.microsoft.com/en-us/help/839300/how-to-use-the-allowpartiallytrustedcallers-attribute-to-call-an-assembly-that-has-a-strong-name-from-a-web-page-by-using-visual-c-.net,-visual-c-2005-or-later-versions

私はセキュリティ権限がどこのHttpContextすなわちFileIOPermissionまたはPrincipalPermissionのために必要なものを確認されませんでした。だから私はSecurityPermissionオプションを使用して終了しました。

ただし、これで問題は解決しませんでした。任意のアイデアをいただければ幸いです。ありがとうございます。

答えて

2

プラグインがサンドボックス内で実行されているため、おそらくこのエラーが発生しています。

Plug-in isolation, trusts, and statistics

Microsoft Dynamics 365 (online & on-premises) support the execution of plug-ins and custom workflow activities in an isolated environment. In this isolated environment, also known as a sandbox, a plug-in or custom activity can make use of the full power of the Microsoft Dynamics 365 SDK to access the organization web service. Access to the file system, system event log, certain network protocols, registry, and more is prevented in the sandbox.

あなたはサンドボックスの外にプラグインを移動してみてください - 登録をプラグイン時に分離モードを探します。

しかし、レコードフィールドからデータを読み取るなど、全く別の方法をとることをおすすめします。クエリ文字列からの読み取りは少し珍しく、クエリ文字列形式はCRMバージョン間で変更されることが知られています。

+0

ご回答ありがとうございます。私たちの環境はオンラインなので、プラグインをサンドボックスから移動することはできません。このシナリオは珍しいものですが、外部サービスを照会するための参照ID(カスタムパラメータではなく)としてレコードIDを使用するような回避策を実装しました。 – noobie

関連する問題