http://www.csdn.net/expert/topic/338/338998.xml?temp=.8206903

解决方案 »

  1.   

    this is someone's codes I found in internet.
    Code to install the site:
     IADsContainerPtr spAC;  <B style="color:black;background-color:#A0FFFF">ADsGetObject</B>(L"IIS://LocalHost/W3SVC", IID_IADsContainer, (void**)&spAC);  IDispatch* spDisp;  spAC->Create(L"<B style="color:black;background-color:#ffff66">IIsWebServer</B>", _bstr_t(NATFormat("%ld",
    NrOfWebServers+1).c_str()), &spDisp);  IADsPtr spADs( spDisp );  spADs->Put(L"Class", _variant_t("<B style="color:black;background-color:#ffff66">IIsWebServer</B>") );
      spADs->Put(L"ServerSize", _variant_t("1"));
      spADs->Put(L"ServerComment", _variant_t( SiteName ));
      _bstr_t ServerBindings = _bstr_t(IPAddress) + ":" + _bstr_t(TCPPort) + ":"
    + _bstr_t(HostHeaderName);
      spADs->Put(L"ServerBindings", _variant_t(ServerBindings));
      spADs->Put(L"ServerState", _variant_t("4"));
      spADs->Put(L"AspAllowSessionState", _variant_t(VARIANT_FALSE));
      spADs->Put(L"AspBufferingOn", _variant_t(VARIANT_TRUE));
      spADs->Put(L"EnableDirBrowsing", _variant_t(VARIANT_FALSE));
      spADs->Put(L"AuthAnonymous", _variant_t(VARIANT_TRUE));
      spADs->Put(L"AuthNTLM", _variant_t(VARIANT_FALSE));
      spADs->Put(L"AccessRead", _variant_t(VARIANT_TRUE));
      spADs->Put(L"AccessWrite", _variant_t(VARIANT_FALSE));
      spADs->Put(L"AccessScript", _variant_t(VARIANT_TRUE));
      spADs->Put(L"AccessNoRemoteScript", _variant_t(VARIANT_FALSE));
      spADs->Put(L"AppIsolated", _variant_t(0L));
      spADs->Put(L"CacheISAPI", _variant_t(VARIANT_TRUE));  spADs->SetInfo();  InvokeMethod(spDisp, "Start");  spAC = spADs;  spAC->Create(L"IIsWebVirtualDir", L"ROOT", &spDisp);  spADs = spDisp;  spADs->Put(L"Path", _variant_t(HomeDirectoryPath));  InvokeMethod(spDisp, "AppCreate", _variant_t(VARIANT_TRUE, VT_BOOL));  spADs->SetInfo();
    多站点只能在NT Server上面创建,NT工作站或者Win2k Profession不支持创建多站点。
      

  2.   

    其实在IIS安装的时候有一个目录,里面都是例子。
    \Inetpub\AdminScripts不过是asp的用法。
    请你参考吧