zoukankan      html  css  js  c++  java
  • C#调用exe文件,IIS发布后无法掉用本地exe程序的解决方法

    http://blog.csdn.net/junjieking/article/details/6277836?reload
    这位楼主的问题,我也遇到了,但是我按照他那样操作并没有解决问题,弄了好久终于找到解决方案了,

    方案如下:IIS管理器——应用程序池——设置应用程序池默认设置——进程模型——标识,这个标识里面有内置账户和自定义账户,我设置自定义账户,然后填上Administration(必须是管理员账户或者拥有管理员权限的账户)和密码。
    PS:我的系统是windows7的系统,其他应该也差不多,希望能帮到各位。出现这个问题的原因就是IIS没有调用exe的权限,所以给它最高权限就可以了。

    我做的这个系统是想通过C#调用plink.exe这个软件连接linux机器,并管理linux机器(增加用户,修改权限什么的),然后通过给plink.exe传参来达到这些增删改用户以及权限,下面是我的代码:
    using System.IO; //StreamWriter
    using System.Diagnostics;
    using System.ComponentModel;

                    ProcessStartInfo pInfo = new ProcessStartInfo();
                    pInfo.Arguments = "-ssh wp@192.168.1.188 -pw wp";
                    pInfo.FileName = Server.MapPath("~/plink.exe");
                    Process p = new Process();
                    p.StartInfo = pInfo;
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardInput = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.CreateNoWindow = true;
                    p.Start();

                    StreamWriter myStreamWriter = p.StandardInput;
                    myStreamWriter.WriteLine("sudo useradd -d /home/wp-s /bin/bash -m wp");
                    myStreamWriter.WriteLine("sudo su root -c 'echo "wp:wp" | chpasswd'");
                  
                    myStreamWriter.WriteLine("exit");
                    StreamReader ss = p.StandardOutput;

                    pand = ss.ReadLine().ToString();
                    p.StandardInput.Flush();
                    p.WaitForExit();
                    p.Close();
    如果以上设置还是不管用,请继续设置:

    计算机 ——管理——服务——IIS Admin Service ——属性——登陆——允许服务与桌面交互(勾上)

    C#调用exe文件,IIS发布后无法掉用本地exe程序的解决方法

    打开IIS管理器:

    IIS身份验证——匿名身份验证——启用

    C#调用exe文件,IIS发布后无法掉用本地exe程序的解决方法

    .NET 信任级别 ——Full internal ——应用

    C#调用exe文件,IIS发布后无法掉用本地exe程序的解决方法



    网站——绑定——添加——IP填上本机IP

    C#调用exe文件,IIS发布后无法掉用本地exe程序的解决方法



    参考连接:
    http://social.msdn.microsoft.com/Forums/zh-CN/csharpgeneral/thread/c14d5871-28c9-4bfc-a56d-d3d3a50395f4
    http://support.microsoft.com/kb/317012/zh-cn

  • 相关阅读:
    DP入门——迷宫行走方案2
    DP入门——迷宫行走方案1
    DFS入门——八皇后问题输出方案
    matplotlib的学习3-figure图像
    matplotlib的学习2-基本用法
    matplotlib的学习1-为什么学他
    numpy的好处
    pandas的学习8-pandas-plot出图
    pandas的学习6-合并concat
    pandas的学习5-导入导出数据
  • 原文地址:https://www.cnblogs.com/magicsong/p/5720573.html
Copyright © 2011-2022 走看看