asp.net调用exe并传递参数然后关闭exe
2011-11-25 09:39
369 查看
先用C#写个简单的exe,这里我就用winForm
Program.cs这里加了个启动参数
大气象
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Diagnostics;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService
{
[DllImport("shell32.dll ")]
public static extern int ShellExecute(IntPtr hwnd, StringBuilder lpszOp, StringBuilder lpszFile, StringBuilder lpszParams, StringBuilder lpszDir, int FsShowCmd);
public WebService()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
ShellExecute(IntPtr.Zero, new StringBuilder("Open"), new StringBuilder("hi"), new StringBuilder("jjj"), new StringBuilder(@"D:\"), 1);
return "Hello World";
}
}
这是目前asp.net调用exe找到的正确运行的方法。放在IIS中正确运行。
Program.cs这里加了个启动参数
大气象
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Diagnostics;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService
{
[DllImport("shell32.dll ")]
public static extern int ShellExecute(IntPtr hwnd, StringBuilder lpszOp, StringBuilder lpszFile, StringBuilder lpszParams, StringBuilder lpszDir, int FsShowCmd);
public WebService()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
ShellExecute(IntPtr.Zero, new StringBuilder("Open"), new StringBuilder("hi"), new StringBuilder("jjj"), new StringBuilder(@"D:\"), 1);
return "Hello World";
}
}
这是目前asp.net调用exe找到的正确运行的方法。放在IIS中正确运行。
相关文章推荐
- asp.net调用exe并传递参数然后关闭exe
- asp.net调用exe并传递参数然后关闭exe[转]
- 【问题】Asp.net MVC 的cshtml页面中调用JS方法传递字符串变量参数
- ASP.net动态调用非托管DLL的参数传递问题
- asp.net中调用用户控件中的函数并传递参数
- asp.net中调用用户控件中的函数并传递参数
- 再谈 asp.net 客户端调用服务器端事件并传递参数
- PHP通过传递对象参数调用asp.net Webservice 服务
- ASP.net动态调用非托管DLL的参数传递问题
- Asp.net ajax 调用WebService 用userContext 传递不了参数的错误
- ASP.NET中使用C#调用服务器端exe可执行文件
- [ZT]Asp.net页面传递参数的几种方法对比讲解
- asp.net 调用存储过程(带有输入,输出参数 ,思路)二
- Asp.net Mvc Codeplex Preview 5 第三篇 实现Action参数传递繁杂类型 【转】
- ASP.NET中向JS传递参数
- 在ASP.NET里通过URL传递参数得到乱码的解决方法
- 【转载】asp,net中参数的传递方法
- ASP.NET 页面间传递参数的方法
- ASP.net中通过HyperLink的NavigateUrl属性传递参数,与新页面的Page_Load()接收参数