日期:2014-05-17 浏览次数:20985 次
try
{
//创建HttpListener对象
using (HttpListener hlistener = new HttpListener())
{
//获取设置用户端身份验证
hlistener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
//设置url前缀$
//hlistener.Prefixes.Add("http://localhost:8080/web/");
//通过IP来访问
//获取app.config文件的url地址
string HttpUrl = System.Configuration.ConfigurationManager.AppSettings["HttpURL"].ToString();
hlistener.Prefixes.Add(HttpUrl);
//接收传入请求
hlistener.Start();
//创建connection对象
SqlConnection conn = new SqlConnection("server=.;database=StuTest;uid=sa;pwd=xdxadmin");
while (true)