0

I have a self-hosted WCF service (VB) residing on a server. This service has a method, which I call from another application, that is supposed to kick off a .cmd file which calls a 3rd party program.

My WCF has used both the old Shell() command and the Process() object. Both can call the .cmd file (located on the server's local drive). The .cmd file looks like this:

echo Before calling 3rd party app >> C:\HelloFubar.txt
cd C:\Program Files\Exstream\Dialog 6.1
Engine -CONTROLFILE=C:\Exstream\Development\LetterWriter\Control Files\Letter.opt
echo After calling 3rd party app >> C:\HelloFubar.txt

Now I know the .cmd file (saved as Letter.cmd) is firing because when I check the txt file after testing my app, the before/after statements have been written. However, the 3rd party application does not start.

Now the weird part -- if I double click the cmd file from explorer, the test statements are written to the text file AND the 3rd party application kicks off. Runs great.

I've double-checked the application and corresponding files to make sure NETWORK_SERVICE has permissions and my service is running under that account. So this does not seem to be a rights issue.

Any ideas?

Thanks, Jason

  • possible duplicate of [Process.Start not starting](http://stackoverflow.com/questions/6113517/process-start-not-starting) – rerun May 24 '11 at 16:59
  • Update your old question. With the additional info please – rerun May 24 '11 at 17:00
  • how do you know that your process isn't starting? – Oskar Kjellin May 24 '11 at 17:07
  • Not a duplicate, this an entirely different issue (rerun). The 'Engine' command is supposed to create output (a pdf document). When I double-click this cmd file, the echo statements fire and the Engine creates the PDF. Now when the WCF calls the cmd file, the echo statements fire but the Engine does not create output. –  May 25 '11 at 20:16
  • I have given rights to NETWORK_SERVICE to execute the Engine, as well as all files it uses. –  May 25 '11 at 20:17

1 Answers1

1

Whew! Only took a week or two!

Note to self:

Self, you must make sure that any 3rd party applications kicked off from the NETWORK_SERVICE account are not trying to do things the NETWORK_SERVICE account does not have explicit rights to do. Like write to the registry, delete files and other tasks.

Try starting the service under an admins account, and make sure to use the servicePrincipalName attribute in the client when calling a WCF running under any account other than NETWORK_SERVICE. An example would be like this in the client's config file:

<endpoint address="net.tcp://myserver-2:8080/Service" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService1" contract="TCPService.IService1"
name="NetTcpBinding_IService1">
  <identity>
     <servicePrincipalName value="MyServiceReferenceName(InSolutionExplorer)\myserver-2"/>
     <dns value="myserver-2.mydomain.local" />
  </identity>
</endpoint>

Hope this can help somebody else out there!