发新话题
打印

IS10.5:用脚本创建虚似目录、ISAPI筛选器、web服务扩展

1 创建虚似目录

         创建一 个InstallScript Project,展开“Server Configuration->Internet Information Services”,直观的点击右键创建新的虚似目录。问题又出现了,当本机没有安装IIS的时候, 安装包显示一个错误信息直接就退出了,帮主说要先检测本机有没有I IS,没有的话要跳出对话框让用户选择是继续安装还是退出安装。被逼无奈,只能到处找资料把问题解决。

       找到检测本机是否安装IIS的脚本,如下:

prototype CheckIIS();//监测系统是否安装了IIS 
  
function CheckIIS()
NUMBER nvType, nvSize;
STRING svvalue;
begin
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
if (RegDBKeyExist ("System\\CurrentControlSet\\Services\\IISADMIN" ) = 1)
then
return (1);
else
return (0);
endif;
end;   <--Element not supported - Type: 8 Name: #comment-->

     接下来就是要寻找如何用InstallScript创建虚似目录了,还是上次推荐的地方,有两篇配置IIS的文章又帮了我一个忙 :
    
http://blog.xiaozhu.com/play/category/56.aspx
    

        在二帮主的帮助下写出了创 建虚似目录的脚本,如下:

 set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
    if (IsObject(objIIS_Root)) then
        try
           set objVirtDir = objIIS_Root.Create("IISWebVirtualDir",VIRTUALDIR );
           if (IsObject(objVirtDir)) then
             objVirtDir.Path = VIRTUALDIRPATH;
             objVirtDir.AccessRead = TRUE;
             objVirtDir.AccessScript = TRUE;
             objVirtDir.AccessExecute = TRUE;
             objVirtDir.SetInfo();
             objVirtDir.AppCreate(TRUE);
             objVirtDir.SetInfo();
             
         endif;
      catch
        set objVirtDir = CoGetObject("IIS://localhost/W3SVC/1/Root/"+VIRTUALDIR,"");& nbsp; 
        if(IsObject( objVirtDir))  then
         MessageBox("存在同名虚似目录",WARNING);
        endif;
      endcatch;
    endif; <--Element not supported - Type: 8 Name: #comment-->
2 创建ISPAI筛选器

    创建ISAPI筛选器的脚本:

TOP

发新话题