代码:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Test("Jack"));//不传值,显示Jack
Console.WriteLine(Test("Jack", "Hi"));//传一个值,显示Jack Hi
Console.WriteLine(Test("Jack", "Hi", "How are you?"));//传多个值,显示Jack Hi How are you?
Console.ReadKey();
}
static string Te ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
namespace SinvanCMS.Common
{
/// <summary>
/// 全局类,当前域名,物理路径
/// </summary>
public class Application
{
/// <summary>
/// 获得url路径, http://localhost/www_dalian/fangyuan.asp 的app部分如:http://localhost/www_dalian
/// </summary>
public static string AppUrl
{
get
{
return "http://" + System.Web.HttpContext.Current.Request. ......
设置serviceProcessInstaller1控件的Account属性为“LocalSystem”
设置serviceInstaller1控件的StartType属性为"Automatic"
在服务器上添加安装程序,在private void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)事件中,添加以下代码:
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
string Cmdstring = "sc start myservice"; //CMD命令
p.StandardInput.WriteLine(Cmdstring);
p.StandardInput.WriteLine("exit");
即可在安装服务后立刻启动windows服务
注: 引用using System.Diagnostics;//调用Process
C#安装布署
建立一个新的安装项目ServerSetup(为刚才那个服务建立一个安装项目)
右键-添加-项目输出-主输出-选择Ser ......
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
  ......
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
  ......
ASP.NET C# 生成静态页面简单方法
//源码是替换掉模板中的特征字符
string mbPath = Server.MapPath("template.html");
Encoding code = Encoding.GetEncoding("gb2312");
StreamReader sr = null;
StreamWriter sw = null;
string str = null;
//读取
try
{
......
ASP.NET C# 生成静态页面简单方法
//源码是替换掉模板中的特征字符
string mbPath = Server.MapPath("template.html");
Encoding code = Encoding.GetEncoding("gb2312");
StreamReader sr = null;
StreamWriter sw = null;
string str = null;
//读取
try
{
......
/*
本段代码在公司项目中实际远程调用第三方公司提供的C#开发WebService的示例
*/
/**
* 登录游戏
*
* @param paramPN
* @param paramTerraceID
* @param paramSvrID
*/
private String loginGame(String paramPN, HttpServletRequest req){
String wsURL = WebGameConfig.getString("wsURL");
String paramTerraceID = WebGameConfig.getString("paramTerraceID");
String paramSvrID = WebGameConfig.getString("paramSvrID");
String key = WebGameConfig.getString("blsdKEY");
String paramIP = HttpUtils.getRemoteAddr(req);
log.warn("wsURL=" + wsURL + "|paramTerraceID=" +paramTerraceID + "|paramSvrID=" + paramSvrID + "|key=" + key + "|paramIP=" + paramIP);
// 推广员编号为空
String paramExpandID = null;
try {
Service service = new Service();
Call call = (Call)service.crea ......
/*
本段代码在公司项目中实际远程调用第三方公司提供的C#开发WebService的示例
*/
/**
* 登录游戏
*
* @param paramPN
* @param paramTerraceID
* @param paramSvrID
*/
private String loginGame(String paramPN, HttpServletRequest req){
String wsURL = WebGameConfig.getString("wsURL");
String paramTerraceID = WebGameConfig.getString("paramTerraceID");
String paramSvrID = WebGameConfig.getString("paramSvrID");
String key = WebGameConfig.getString("blsdKEY");
String paramIP = HttpUtils.getRemoteAddr(req);
log.warn("wsURL=" + wsURL + "|paramTerraceID=" +paramTerraceID + "|paramSvrID=" + paramSvrID + "|key=" + key + "|paramIP=" + paramIP);
// 推广员编号为空
String paramExpandID = null;
try {
Service service = new Service();
Call call = (Call)service.crea ......