• SmartInstallMaker 安装包exe的制作


    前言:

    使用SmartInstallMaker 安装包制作工具完成打包程序,之前需还原DB,创建IIS站点,完成打包程序的制作。还涉及到为计算机创建用户、上传或者下载文件夹权限用户与共享的设置、IIS虚拟目录的创建及权限、用户的配置.下面分别阐述以上知识点的解决方案。

      整体思路:计算机用户创建--->(DB、IIS、某几个文件权限的写入配置)--->读取配置DB还原--->读取配置forIIS站点配置、某几个文件权限--->虚拟目录创建及权限用户--->上传与下载文件夹权限与共享--->删除DB、IIS站点、安装文件夹(某几个)共享配置--->安装成功,进行测试。


     第一:为计算机新增用户、文件夹权限用户与共享的设置,都可以使用运行cmd 命令即可

    Code
     1 #region  为计算机 创建 FileUser用户密码:sdzn123456 Add by:lei 2012-05-09 11:23
     2 
     3                 System.Diagnostics.Process p = new System.Diagnostics.Process();
     4                 p.StartInfo.FileName = "CMD.EXE";
     5 
     6                 p.StartInfo.FileName = "cmd.exe";
     7                 p.StartInfo.UseShellExecute = false;
     8                 p.StartInfo.RedirectStandardInput = true;
     9                 p.StartInfo.RedirectStandardOutput = true;
    10                 p.StartInfo.RedirectStandardError = true;
    11                 p.StartInfo.CreateNoWindow = true;
    12                 p.Start();
    13 
    14 
    15                 p.StandardInput.WriteLine("net user FileUser sdzn123456 /add");
    16                 p.StandardInput.WriteLine("net localgroup administrators FileUser /add");
    17                 p.StandardInput.WriteLine("exit");
    18 
    19                 p.WaitForExit();
    20 
    21                 #endregion

    设置权限及共享

    权限与共享 Code
     1     #region 为uploadCenter文件设置共享及fileuser用户所有权限 Add by:LEI 2012-05-09 19:29(Program.filepath:具体c:\)
     2 
     3                 System.Diagnostics.Process p2 = new System.Diagnostics.Process();
     4                 p2.StartInfo.FileName = "CMD.EXE";
     5 
     6                 p2.StartInfo.FileName = "cmd.exe";
     7                 p2.StartInfo.UseShellExecute = false;
     8                 p2.StartInfo.RedirectStandardInput = true;
     9                 p2.StartInfo.RedirectStandardOutput = true;
    10                 p2.StartInfo.RedirectStandardError = true;
    11                 p2.StartInfo.CreateNoWindow = true;
    12                 p2.Start();
    13 
    14                 string s = "\"" + Program.filepath + "\\" + "UploadCenter1"+"\"";
    15                
    16                 p2.StandardInput.WriteLine("net share Upload= " + s + " /grant:fileuser,full");                
    17                 p2.StandardInput.WriteLine("exit");
    18 
    19                 p2.WaitForExit();
    20 
    21                 #endregion

    第二:iis虚拟目录创建及用户配置(网上搜索很多种解决方案,最终参考这个,感谢作者)

     第三:写DB、iis、文件权限的配置(注意:路径与参数)

    以写DB配置为例:

     实际:使用一个Ini类里面的set_value方法

    第四:读取以上三个配置分别进行 DB还原 IIS站点创建 文件夹权限配置

    以DB为例:

    DB还原 Code
    1   System.Diagnostics.Process exep1 = new System.Diagnostics.Process();
    2                 exep1.StartInfo.FileName = Program.filepath + @"\Web\setup\自动配置数据库_控制台版V1.0_20120502.exe";
    3                 exep1.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
    4                 exep1.StartInfo.CreateNoWindow = false;
    5                 exep1.StartInfo.UseShellExecute = false;
    6                 exep1.Start();
    7                 exep1.WaitForExit();

    实际:调用外部exe小程序进行还原(具体小程序功能根据传入参数的不同进行备份、还原、删除等操作)

    第五:删除配置三个文件,直接删除文件所在文件夹即可(注意:路径)

    Directory.Delete(Program.filepath + @"\Web\setup", true);

    总结:

    1.虚拟目录创建与配置用户耗时较多,主要是网上搜索资料有限以及资料的真伪性。

    2.对创建计算机用户、共享权限尽可能让程序(cmd)去做,代替实施人员的操作。

    3.调用外部exe的思路的学习。

  • 相关阅读:
    maven打包出错: Failed to clean project: Failed to delete
    Image.Save()发生“GDI+ 中发生一般性错误”
    Vue.js——60分钟快速入门
    PHP-输入变量
    ThinkPHP框架开发的应用的标准执行流程
    ThinkPHP 3.2.2 在 volist 多重循环嵌套中使用 if 判断标签
    ThinkPHP 数据库操作之数据表模型和基础模型 ( Model )
    Namespace declaration statement has to be the very first statement in the script
    ThinkPHP 学习笔记 ( 一 ) 项目部署:应用部署方式与模块分组部署方式
    ThinkPHP 3.2.3 简单后台模块开发(一)常用配置
  • 原文地址:https://www.cnblogs.com/lei2007/p/2522386.html
Copyright © 2020-2023  润新知