如何用IIS用户环境变量 [英] How to use environment variable with IIS user
问题描述
我有一个运行的.bat
文件的WCF服务。它的工作原理我的本地系统上,但我有一个问题,与服务器(Windows Server 2012 R2)上运行它。
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).
我所定义的 ANT_HOME
变量服务器的环境变量,我已经添加了%ANT_HOME%\\ bin中
到路径
变量。
I've defined the ANT_HOME
variable to server's environment variables and I've added %ANT_HOME%\bin
to Path
variable.
在我写的蚂蚁
到CMD它工作在服务器上!但是,当我从什么地方叫 WCF
服务,这是行不通的。
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.
据这篇日志,我的理解是IIS用户不能使用已经定义的 ANT_HOME
变量。
我迄今为止尝试:
- 身份冒充
- 充分权限IIS用户
推荐答案
什么版本的IIS,你运行?如果您使用的版本,您可以创建一个单独的为您服务的应用程序池那么这样做,并给这个应用程序池具有正确的道路或定义ANT_HOME该用户的身份。我总是喜欢添加平式的方法来我的所有服务,所以我可以问这是谁的运行,并在那里运行的服务。这是伟大的故障排除和测试WCF服务。
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.
这篇关于如何用IIS用户环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!