I have a WCF service that runs a .bat
file. It works on my local system, but I have a problem with running it on the server (Windows server 2012 r2).
I've defined the ANT_HOME
variable to server's environment variables and I've added %ANT_HOME%\bin
to Path
variable.
When I write "ant
" to CMD on the server it works! But when I call the wcf
service from somewhere, it doesn't work.
I found the following error in the log files:
'ant' is not recognized as an internal or external command,
operable program or batch file.
According to this log, I understand that IIS user cannot use the ANT_HOME
variable which is already defined.
What I have tried so far:
- identity impersonate
- giving full permission to IIS user
What version of IIS are you running? If you are running a version where you can create a separate Application Pool for your service then do so and give this Application Pool an identity that has the right PATH or defines ANT_HOME for that user. I always like adding a Ping type method to all my services so I can ask the service who it is running as and where it is running. It is great for troubleshooting and testing WCF services.