调用或从C#Web服务调用C#控制台应用程序?

调用或从C#Web服务调用C#控制台应用程序?

问题描述:

由于我的问题,我无法通过我的web服务运行DOS命令。

Due to my problem that I am unable to run dos command via my web service.

C#Web服务运行批处理文件或DOS命令

C# web service running batch file or dos command?

因为我不能让我的web服务运行DOS命令直接,我现在想创建C#控制台应用程序,将运行我的DOS命令,则控制台应用程序将被Web服务调用。

Since I cannot make my web service run dos command directly, I am now thinking about creating C# console app that will run my dos command, then the console app will be invoked by web service.

是否有可能这样做?

调用从另一个.NET应用程序一个.NET控制台应用程序最简单的方法是在装配联系起来,并调用静态方法直接。但是,如果有任何理由不能执行命令(权限),那么你就必须用这种方法同样的问题。

The easiest method to call a .Net console application from another .Net application is to link in the assembly, and invoke the static Main method directly. But if there is any reason you can't execute commands (permissions), then you'll have the same problems with this method.

如果权限问题,那么你可以:

If permissions are the problem, then you could:


  • 更改ASP.Net使用承载您的Web服务的帐户

  • 创建一个Windows服务承载WCF或.NET远程监听器。设计听者产卵,你需要运行的进程。运行与您需要的权限,该服务

此外,作为约翰·Kalberer提到的,它可能与这些服务无法与桌面交互。如果这是问题所在,then看到这个问题。

Also, as John Kalberer mentioned, it could be related to the inability of these services to interact with the desktop. If this is the problem, then see this question.