- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我正在处理的 ASP.Net MVC 4 Web 应用程序中。我有一个页面基本上通过从 SOAP 服务获取数据来生成报告。
我的代码基本上是这样的
List<CustomThings> serverInfos = ServerInfos;
serverInfos.AsParallel().ForAll(srvInfo =>
{
SoapHttpClientProtocol soapProxy = CreateProxy(srvInfo);
//call make soap calls through the soap client
//store results in the proper places
}
我在这里使用 AsParallel 的原因是因为以串行方式通过 HTTP 执行多个请求需要很长时间。我应该指出,这段代码确实有效,尽管偶尔会有效。
是否有可能以不可预测的方式处理事情,而 PLINQ 不是我在这里尝试做的事情的好解决方案?
是否有可能另一个线程问题会导致错误,使 soap 客户端“放弃”?
这个特定的 soap 代理正在与 ArcGIS Server 对话。通常,您可以检查服务器日志并查看特定请求何时发起以及请求是否失败。这些日志中没有显示任何内容。
这是我从 AsParallel 代码中获得的内部异常堆栈跟踪示例。
Exception: System.AggregateException: One or more errors occurred. ---> System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- End of inner exception stack trace --- at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at ESRI.ArcGIS.SOAP.FeatureServerProxy.Query(Int32 LayerOrTableID, String DefinitionExpression, QueryFilter QueryFilter, ServiceDataOptions ServiceDataOptions, String GdbVersion, Double MaximumAllowableOffset) at System.Linq.Parallel.SelectQueryOperator
2.SelectQueryOperatorResults.GetElement(Int32
1.get_Item(Int32 index) at System.Linq.Parallel.PartitionedDataSource
index) at System.Linq.Parallel.QueryResults1.ListContiguousIndexRangeEnumerator.MoveNext(T&
2.SpoolingWork() at System.Linq.Parallel.SpoolingTaskBase.Work() at System.Linq.Parallel.QueryTask.BaseWork(Object unused) at System.Linq.Parallel.QueryTask.<.cctor>b__0(Object o) at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute()
currentElement, Int32& currentKey) at
System.Linq.Parallel.PipelineSpoolingTask
最佳答案
PLINQ 甚至不知道您的连接对象存在。它无法关闭它。
仔细阅读消息:
An existing connection was forcibly closed by the remote host.
服务器以意外方式关闭了连接。您的客户没有错。
准确解释异常是一项基本的调试技巧。此信息就在异常消息中。
也许您产生了过多的负载。设置可持续的并行度。默认启发式算法适用于 CPU 工作,而不适用于 IO。
.WithDegreeOfParallelism(10)
A connection that was expected to be kept alive was closed by the server.
这可能意味着服务器不支持 HTTP keep alive。
关于c# - Linq AsParallel() 可以过早地处理 SoapHttpClientProtocol 对象吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26307371/
我只是对此感到好奇。我正在这个项目中进行更改,即使用 NetSuite Web 服务,有时它会随机抛出 SoapException,“一次只能针对一个 session 发出一个请求”。 pri
我通过 wsdl.exe 从 WSDL-URL 创建了一个 C# 代理类。我在我无法控制的 Web 应用程序的上下文中使用此代理类(因此无法更改 web.conf 或类似内容)。我也无法更改正在与之通
我使用 VS 2008 (c#) 的“添加 Web 引用”功能创建了一个 Web 服务代理。 生成的类派生自SoapHttpClientProtocol 我可以在单例中只存储一个代理实例吗?它是线程安
我有一个基于 SoapHttpClientProtocol 的 Web 服务引用 (.NET CF 3.5)。我的问题是——除了调用 web 方法之外,有没有办法确定是否建立了与 WebService
这几天我们的应用程序出现了问题。我们使用 SoapHttpClientProtocol 来调用 java mbean。这基本上是调用 java webservice 来调用方法。 我们的问题是有时会出
我正在用 Microsoft Dynamics CRM 做一些实验。您通过 Web 服务与它交互,并且我已向我的项目添加了一个 Web 引用。 web服务接口(interface)非常丰富,生成的“R
我需要告诉我的 C# soap Web 服务消费者不要验证证书而只接受它。这可能吗? 原因:我们发布了一个仅限 https 的网络服务。客户端需要使用它但有某种防火墙/代理(WebSense?),它对
当我为 Web 服务创建 Web 引用时,Visual Studio 神奇地创建了一个设置类,它允许我通过应用程序配置更改引用的 Web 服务 URL。对于在不重建代码的情况下在开发和生产服务器之间进
我可以自动转换从 WSDL 创建的 SoapHttpClientProtocol 类以使用 HTTPS 协议(protocol)而不是 HTTP 吗? (如果,如何?) 简单地将 web 服务的 UR
在我正在处理的 ASP.Net MVC 4 Web 应用程序中。我有一个页面基本上通过从 SOAP 服务获取数据来生成报告。 我的代码基本上是这样的 List serverInfos = Server
尽管在 Visual Studio 2005 中的客户端项目上启用了 WSE 3.0,但我所做的 Web 引用总是以从 SoapHttpClientProtocol 派生的服务代理结束。我必须手动将继
我正在从基于 C# 表单的应用中调用 Web 服务。 ServReturnType obj = ServProxyClass(int i, int k); 我有可能取回异常。异常可能是服务根本没有连接
我在 ASP.NET MVC4 中调用第三方 SOAP 服务(Magento 网上商店)。导入 Web 服务引用时,所有服务方法都由 Visual Studio 自动实现,例如登录 soap 方法实现
SO 上有很多关于此的帖子,我已经搜索过它们,但仍然没有解决方案。我希望有人能指出我正确的方向。 我们现在需要使用 TLS 1.2 连接到远程提供商。所以我安装了 Windows Server 201
无法从 C# 代码访问 https url。试图访问 https://blabla url并访问get方法。这是 SOAP 从 wsdl 生成的 c# 类。它可以从 SOAP UI 正常工作,但不能从
现在发现 SSL 3 容易受到 POODLE 的攻击攻击: System.Web.Services.Protocols.SoapHttpClientProtocol 在连接到任何 https Uri
现在发现 SSL 3 容易受到 POODLE 的攻击攻击: System.Web.Services.Protocols.SoapHttpClientProtocol 在连接到任何 https Uri
我正在使用动态实例化 SoapHttpClientProtocol 的代码对象(代理类)并使用该对象调用 WS-Basic I Web 服务。这是我的代码的简化版本: public override
我在 .NET 中有一个 SOAP Web 服务,它使用: System.Web.Services.Protocols.SoapHttpClientProtocol 如何获取通过 HTTP 发送的原始
我正在尝试从 C# 应用程序调用 Web 服务,但出现异常: InvalidOperationException client found response content type of 'text
我是一名优秀的程序员,十分优秀!