15

WCF REST サービスから実行しようとしている powershell スクリプトがあります。アセンブリSystem.Management.AutomationSystem.Management.Automation.Runspacesアセンブリを使用しています。

C# コードは次のようになります。

Command command = new Command(path);
command.Parameters.Add(param);
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
using (Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration))
{
    runspace.Open();
    ... other code
}

open ステートメントを実行しようとすると、このエラーが発生します。

動的操作は同種の AppDomain でのみ実行できます。

私は見て見ましたが、何も機能しませんでした。この行を web.config に追加しようとしましたが、何もしませんでした。

考えはありますか?

4

1 に答える 1