try
{
answer=int.Parse(context.Request.Params["answer"].ToString());
}
catch
{
answer=0;
}
try
{
if(HttpContext.Current.Request.ServerVariables["HTTP_VIA"]!=null)
{
ip=HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip=HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}
}
catch
{
ip="";
}
try
{
intnum=dal.VoteAdd(sid,qid,answer,ip);
if(num>0)
{
HttpContext.Current.Response.Write("{\"flag\":\"1\",\"msg\":\"投票成功\"}");
}
else
{
HttpContext.Current.Response.Write("{\"flag\":\"0\",\"msg\":\"插入失败\"}");
}
}
catch(Exceptionex)
{
thrownewException(ex.Message);
//HttpContext.Current.Response.Write("{\"flag\":\"-1\",\"msg\":\"程序错误"+newException(ex.Message)+"\"}");
}
做的一个投票,大概一分钟内有100-200个请求
IIS事件监控这段代码报错自己测试并没有错误
Eventmessage:Anunhandledexceptionhasoccurred.
Exceptioninformation:
Exceptiontype:NullReferenceException
Exceptionmessage:Objectreferencenotsettoaninstanceofanobject.
atWAP.Global.Application_BeginRequest(Objectsender,EventArgse)
atSystem.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
分 -->
|