月间
个人学习记录,大部分是摘抄式的学习本

问题:

因为84版本以上谷歌禁用了tls1.0和1.1协议,win7本身是不支持tls1.2协议的,于是通过谷歌浏览器访问本地websocket的时候会报错。

目前的解决方案:

  1.直接安装

    双击msu补丁文件直接安装

    出现"无法启动,原因可能是已被禁用或与其相关联的设备没有启动"是因为windows自动更新服务被仅用了额,需要到服务里改成手动或者自动

  2.用bat脚本安装

 

@echo off 
md D:\Update

cd /d %~dp0

expand –F:* Windows6.1-KB3154518-x86.msu D:\Update\
dism.exe /online /Add-Package /PackagePath:D:\Update\Windows6.1-KB3154518-x86.cab

rd/s/q D:\Update

pause

 

  3.c#程序中添加自动安装

    调用cmd,把命令传进去,然后执行。

    //如果是32位程序,运行在64位操作系统上需要添加:

     proc.StandardInput.WriteLine(@"cd /d C:\Windows\Sysnative");

        public string RunCmd(string cmd,string Dect3264)
        {
            try
            {
                Process proc = new Process();
                proc.StartInfo.CreateNoWindow = true;
                proc.StartInfo.FileName = "cmd.exe";
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.RedirectStandardError = true;
                proc.StartInfo.RedirectStandardInput = true;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.Start();
          //如果是32位程序,运行在64位操作系统上需要添加:
           if (Dect3264 == "64") { proc.StandardInput.WriteLine(@"cd /d C:\Windows\Sysnative"); } proc.StandardInput.WriteLine(cmd); proc.StandardInput.WriteLine("exit"); string outStr = proc.StandardOutput.ReadToEnd(); proc.Close();return outStr; } catch (Exception ex) { Exception exp = ex; string msg = ""; while (true) { msg += exp.Message + "\r\n"; msg += exp.StackTrace; if (exp.InnerException == null) { break; } msg += "Caused By:\r\n"; exp = exp.InnerException; } logger.WriteInfoLog("控制台执行出错:\r\n{"+msg+"}"); } return null; }

 

posted on 2020-09-09 15:30  月间  阅读(735)  评论(0)    收藏  举报