※※※如何启动IIS下面的某一个web站点?※※※

kingfish 2003-06-23 07:52:47
通过OpenService,StartService可以启动W3SVC服务
如何通过程序启动一个站点?如“默认web站点”
可能有多个站点存在。


谢谢。

欢迎讨论
...全文
155 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
flmn 2003-06-24
  • 打赏
  • 举报
回复
没考虑过
zxcdewq 2003-06-24
  • 打赏
  • 举报
回复
up
lansingcy 2003-06-24
  • 打赏
  • 举报
回复
在IIS的ADMIN下有一个管理脚本叫什么 .VBS 找到它, CALL IT 就可以了
kingfish 2003-06-24
  • 打赏
  • 举报
回复
startweb.vbs对于多个站点可能也有问题

用StartService写的已能满足需求

帖子先揭了,谢谢关注
kingfish 2003-06-24
  • 打赏
  • 举报
回复
zhaoloudy的方法我觉得和StartService是一样的
如:net start W3SVC
如果IIS启动后,你停止了“默认web站点”,如果再用net start W3SVC启动,系统返回“服务已启动”
kingfish 2003-06-24
  • 打赏
  • 举报
回复
先up,楼上几位的代码我试试
kingfish 2003-06-24
  • 打赏
  • 举报
回复
to lansingcy:
cscript可以用
谢谢!
kingfish 2003-06-24
  • 打赏
  • 举报
回复
to lansingcy:
这种脚本如何调用?能否详细说明一下?谢谢
比如startweb.vbs
ThinkX 2003-06-23
  • 打赏
  • 举报
回复
我觉得这种问题用script解决比较方便。
如果用script可以解决,那么用bcb一定可以解决。
whitelion 2003-06-23
  • 打赏
  • 举报
回复
学习
warton 2003-06-23
  • 打赏
  • 举报
回复
难题!不会!关注
叶子哟 2003-06-23
  • 打赏
  • 举报
回复
看这段vc的代码对你是否有help:

include <windows.h>
#include <Iads.h>
#include <comdef.h>
#include <tchar.h>
#include <stdio.h>
#include <Adshlp.h>
#pragma comment(lib,"ActiveDS")
#pragma comment(lib,"adsiid")
BOOL CreateWebServer(LPCTSTR bindaddress,LPCTSTR domain,LPCTSTR DiskPath);
void main()
{
CoInitialize(NULL);
if(TRUE==CreateWebServer(_T("192.168.0.224:80"),_T("www.masterz.com"),_T("d:\\tmp")))
printf("create site ok\n");
else
printf("create site failed\n");
CoUninitialize();
}
BOOL CreateWebServer(LPCTSTR bindaddress,LPCTSTR domain,LPCTSTR pathname)
{
if(bindaddress==NULL||NULL==domain||NULL==pathname)
return FALSE;
IADsContainer *pCont=NULL;
IADs* pAds=NULL;
IADs* pVrAds=NULL;
IADsServiceOperations *pSrvOp=NULL;
IDispatch *pDisp = NULL;
IDispatch *pVrDisp = NULL;
_bstr_t WNumer="123";
_bstr_t newBindings=_bstr_t(bindaddress)+":"+domain;
HRESULT hr;
if(ADsGetObject(L"IIS://localhost/w3svc",IID_IADsContainer,(void**)&pCont)==S_OK)
{
if(pCont->Create(L"IIsWebServer",WNumer,&pDisp)==S_OK)
{
hr=pDisp->QueryInterface(IID_IADs, (void**)&pAds);
hr=pDisp->QueryInterface(IID_IADsServiceOperations, (void**)&pSrvOp);
pAds->Put(L"ServerSize",_variant_t(long(1)));
pAds->Put(L"ServerComment",_variant_t(_bstr_t("masterz")));
pAds->Put(L"ServerBindings",_variant_t(newBindings));
pAds->SetInfo();

hr=pCont->GetObject(L"IIsWebServer",(WNumer),&pDisp);
if(pDisp->QueryInterface(IID_IADsContainer,(void**)&pCont)==S_OK)
{
if(pCont->Create(L"IIsWebVirtualDir",L"Root",&pVrDisp)==S_OK)
{
hr=pVrDisp->QueryInterface(IID_IADs, (void**)&pVrAds);
pVrAds->Put(L"AccessRead",_variant_t(true));
pVrAds->Put(L"AccessWrite",_variant_t(true));
pVrAds->Put(L"AccessScript",_variant_t(true));
pVrAds->Put(L"EnableDirBrowsing",_variant_t(true));
pVrAds->Put(L"Path",_variant_t(pathname));
pVrAds->Put(L"AppRoot",_variant_t(pathname));
pVrAds->SetInfo();
pVrAds->Release();
pAds->Release();
pCont->Release();
}
hr=pSrvOp->Start();
hr=pSrvOp->Release();
}
}
}
return true;
}
zhaoloudy 2003-06-23
  • 打赏
  • 举报
回复
net start XXXXX
Lewolf 2003-06-23
  • 打赏
  • 举报
回复
没有研究过,关注。
wjmhome 2003-06-23
  • 打赏
  • 举报
回复
up
kingfish 2003-06-23
  • 打赏
  • 举报
回复
下面这种形式:
website1:(如何启动它?)
默认ftp
默认web站点(如何启动它?)
...
website2:
ftp
web
...

13,871

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧