在我的项目中,我称之为Web服务:
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("**********");
req.Method = "POST";
req.ContentType = "application/json";
byte[] postDataAsBytesS = Encoding.UTF8.GetBytes(mobileJSON);
Stream postStreamS = req.GetRequestStream();
postStreamS.Write(postDataAsBytesS, 0, postDataAsBytesS.Length);
postStreamS.Flush();
postStreamS.Dispose();
WebResponse resS = req.GetResponse();
postStreamS = resS.GetResponseStream();
StreamReader srS = new StreamReader(postStreamS);
string responseFromServerS = srS.ReadToEnd();
public static class ExtensionsMethods
{
public static WebResponse GetResponse(this WebRequest request)
{
ManualResetEvent evt = new ManualResetEvent(false);
WebResponse response = null;
request.BeginGetResponse((IAsyncResult ar) => {
response = request.EndGetResponse(ar);
evt.Set();
}, null);
evt.WaitOne();
return response as WebResponse;
}
public static Stream GetRequestStream(this WebRequest request)
{
ManualResetEvent evt = new ManualResetEvent(false);
Stream requestStream = null;
request.BeginGetRequestStream((IAsyncResult ar) => {
requestStream = request.EndGetRequestStream(ar);
evt.Set();
}, null);
evt.WaitOne();
return requestStream;
}
}
当我同时拨打上述Reqeust 2次时,我从网络服务中收到错误。
我收到以下错误:
{"Message":"Column \u0027*****\u0027 doesn't exist in the table.","StackTrace":" in System.Data.DataRow.GetDataColumn(String columnName)\r\n in System.Data.DataRow.get_Item(String columnName)\r\n in webserviceDWA.syncAndroidDWA.GetDWAPDFkategoriezuordnung(dwamobile[] mobile)","ExceptionType":"System.ArgumentException"}
但如果我只做了一次请求,我就没有错误。
你能帮助我吗?
感谢。
答案 0 :(得分:0)
我解决了这个问题。 我设置了设置"最大工作流程数"应用程序池的数量为100。