0

このコマンドだけで問題が発生しましたExecuteAssembly 。パイプ ストリーミング データを使用してアプリを実行し、ネット名付きパイプを使用して wcf に切り替えました。これは問題とは関係ありません。

サーバーは、起動するといくつかの操作を実行します。そのうちの 1 つは、クライアントを実行してサーバーに接続するアセンブリを実行しています。

コード:

String modulePath = (String)path;
AppDomainSetup objDomainSetup = new AppDomainSetup() { ApplicationBase = Path.GetDirectoryName(modulePath) };
string moduleConfigPath = String.Format("{0}.config", modulePath);
if (File.Exists(moduleConfigPath))
{
    // This is important... in case the loding module has a configuration file.
    objDomainSetup.ConfigurationFile = moduleConfigPath;
}

//We give the new app domain the same permission its parent has.
System.Security.Policy.Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
System.Security.Policy.Evidence objEvidence = new System.Security.Policy.Evidence(baseEvidence);
objModuleDomain = AppDomain.CreateDomain(ChannelName, objEvidence, objDomainSetup);
objModuleDomain.ExecuteAssembly(modulePath);

パスを確認しましたが、すべてが正しいようで、パスから指定された .exe が実行されます。しかし、ExecuteAssembly はそこで動かなくなり、次のステートメントは実行されません。

推測はありますか?ありがとう

4

1 に答える 1

0

AppDomain.ExecuteAssembly()アセンブリを実行し、アセンブリが終了すると終了し.exeます。アセンブリが終了しないようにする Sleep(Infinite) がありました。

于 2013-08-19T13:41:21.800 に答える