0

クライアント アプリケーションからプロセスを実行したいのWinformsですが、私の場合、クライアントはサーバーに、サーバーのマシン上に新しいプロセスを作成するように要求します。

public void RunEXE()
{
    var processInfo = new ProcessStartInfo(@"D:\MyFile.exe")
    {
        CreateNoWindow = true,
        UseShellExecute = false
    };
    Process proc;

    if ((proc = Process.Start(processInfo)) == null)
    {
        throw new InvalidOperationException("??");
    }

    proc.WaitForExit();
    int exitCode = proc.ExitCode;
    proc.Close();
}

現在、ローカル マシンでこのサービスを実行しようとしても何も起こりません。更新、文字列の受信などのその他の操作は、ローカル マシンとリモート マシンで正常に動作します。

サーバー app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <system.web>
    <compilation debug="true"/>
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <bindings />
    <client />
    <services>
      <service name="WCFServiceHosting.MyService">
        <endpoint name="ServiceHttpEndPoint" address="" binding="basicHttpBinding" contract="WCFServiceHosting.IParametersXMLService">
        </endpoint>
        <endpoint name="ServiceMexEndPoint" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://0.0.0.0:8733/MyService/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
4

0 に答える 0