简体   繁体   English

如何从Java远程启动/停止IIS 6.0中的应用程序池

[英]how to start/stop an application pool in IIS 6.0 from Java remotely

Can I start and stop IIS 6.0 application pools on one machine from within Java code running on another machine? 是否可以从在另一台计算机上运行的Java代码中启动和停止一台计算机上的IIS 6.0应用程序池? If so, how? 如果是这样,怎么办?

Use Java's facility to execute another program and use the command line tool such as 使用Java的工具来执行另一个程序并使用命令行工具,例如

appcmd stop apppool /apppool.nam
appcmd start apppool /apppool.nam

(see http://technet.microsoft.com/en-us/library/cc732742(WS.10).aspx ) (请参阅http://technet.microsoft.com/zh-cn/library/cc732742(WS.10).aspx

I believe you can do it using WMI. 我相信您可以使用WMI做到这一点。 Please take a look http://msdn.microsoft.com/en-us/library/ms525309(v=vs.90).aspx 请看看http://msdn.microsoft.com/zh-CN/library/ms525309(v=vs.90).aspx

and here: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/9041b0a5-c314-46d9-8f56-01506687f357.mspx?mfr=true 此处: http : //www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/9041b0a5-c314-46d9-8f56-01506687f357.mspx?mfr=true

Or just google "iis wmi". 或只是谷歌“ iis wmi”。

First find API you need and find a way to write JScript or VBScript that does what you need. 首先找到所需的API,然后找到一种编写满足您需求的JScript或VBScript的方法。

Then you have 2 ways. 然后,您有2种方法。

  1. Just execute script you have just done from java using Runtime.exec() 只需使用Runtime.exec()从Java执行刚刚完成的脚本
  2. Use one of interoparability packages like JaWin, JIntegra or JInterop (or, probably others) to call the same code from java. 使用JaWin,JIntegra或JInterop(或可能其他)之类的互操作性程序包从Java调用相同的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM