行 79:  string str=GetMaxID("","TbSendMessage");
行 80:  string random="dg"+"0000000000000000".Substring(0,"0000000000000000".Length-str.Length)+str;
行 81:  StreamWriter sw = new StreamWriter(path,true,Encoding.GetEncoding("gb2312"));
行 82:  sw.WriteLine("<serialno>"+random+"</serialno><sendport>"+config+"</sendport>"+
行 83:  "<mobileno>"+fmobile+"</mobileno><content>"+contect+"</content>"+
错误81行代码如下:
using(StreamWriter sw=new StreamWriter(path))
{ try
{
sw.Write("<serialno>"+random+"</serialno><sendport>"+config+"</sendport>"+
"<mobileno>"+fmobile+"</mobileno><content>"+contect+"</content>"+
"<mesgtype>1</mesgtype><apptype>2</apptype><srr>1</srr>end");
sw.Close();
}
catch
{
sw.Close();
}
finally
{
sw.Close();
}
}

解决方案 »

  1.   

    把w3wp进程先终止掉再访问看看还有这个问题么
      

  2.   

    你根本不用写“sw.Close();”,using{}结构结束的时候sw释放时会自动将其flush和close,你画蛇添足反而一看就是心理没有搞清楚那个using{}是什么。至于你贴的两段代码是什么关系,你想说明什么,我不太看的懂。如果这两段是在两个线程中的,那么完全可以发生冲突。发生这个是平常事。我不知道你把它摊开来想说什么。当你去商店买货,如果你想买的苹果最后一斤恰好被前边一个人买走了,你赶紧大声叫售货员过来补货或者采取其他措施就可以了,摊开手大哭傻在那里没有任何用。
      

  3.   

    Click the link to solve your problem.Good luck!