问题描述
我遇到了应用程序性能问题,因为“由于系统缺少足够的缓冲区空间或队列已满,无法对套接字执行操作。”
应用程序的基本流程是1.Web API的应用程序命中和数据库中WebAPI的命中。
要解决此问题,
- 我已将maxport增加到15000-https://docs.microsoft.com/en-us/troubleshoot/windows-client/networking/connect-tcp-greater-than-5000-error-wsaenobufs-10055
- 验证在应用程序级别关闭的所有连接。 3.我在应用程序中使用“使用中”关键字。 4.我已经验证,Time_wait状态有很多可用连接。
除此以外,如果您还有其他解决方案,请告诉我。
public IHttpActionResult Products([FromBody] ProductRequest productRequest)
{
if (productRequest != null)
{
var request = Mapper.Map<SolrProductRequest>(productRequest);
var response = _searchProxy.GetProducts(request);
return Ok(response);
}
return BadRequest();
}
public string Get(string relativeUrl,IEnumerable<keyvaluePair<string,string>> parameters)
{
var u = new UriBuilder(_serverUrl);
u.Path += relativeUrl;
var request = (HttpWebRequest)WebRequest.Create(u.Uri);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
var qs = string.Join("&",parameters
.Select(kv => string.Format("{0}={1}",HttpUtility.UrlEncode(kv.Key),HttpUtility.UrlEncode(kv.Value)))
.ToArray());
request.ContentLength = Encoding.UTF8.GetByteCount(qs);
request.ProtocolVersion = HttpVersion.Version11;
request.KeepAlive = true;
try
{
using (var postParams = request.GetRequestStream())
using (var sw = new StreamWriter(postParams))
sw.Write(qs);
using (var response = request.GetResponse())
using (var responseStream = response.GetResponseStream())
using (var sr = new StreamReader(responseStream,Encoding.UTF8,true))
{
var solrResult = sr.ReadToEnd();
//if (CustomValues != null && CustomValues.Count > 0)
//{
// PopulateCustomValues(solrResult);
//}
return solrResult;
}
}
catch (WebException e)
{
throw new SolrConnectionException(e);
}
}
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)