gpt4 book ai didi

c# - WCF 服务调用中的 "Thread was being aborted"

转载 作者:太空宇宙 更新时间:2023-11-03 18:17:34 26 4
gpt4 key购买 nike

在我的程序中有一个包含 wcf 客户端的 aspx 页面,因此调用位于同一服务器上的 wcf 服务。

当我的 wcf 客户端调用生产服务器上 IIS 中托管的 wcf 服务时,我会遇到此异常。

例。 msg: 线程正在中止。

Ex 堆栈:

at System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags) at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode) 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) at System.Net.ConnectStream.ProcessWriteCallDone(ConnectionReturnResult returnResult) at System.Net.ConnectStream.CallDone(ConnectionReturnResult returnResult) at System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream, Boolean suppressWrite) at System.Net.HttpWebRequest.EndWriteHeaders_Part2() at System.Net.HttpWebRequest.EndWriteHeaders(Boolean async) at System.Net.HttpWebRequest.WriteHeadersCallback(WebExceptionStatus errorStatus, ConnectStream stream, Boolean async) at System.Net.ConnectStream.WriteHeaders(Boolean async) at System.Net.HttpWebRequest.EndSubmitRequest() at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at StationService.IStationService.GetCurrentStationTrack(String stationId) at StationService.StationServiceClient.GetCurrentStationTrack(String stationId) at GetSongJS.getMarq(String radioIdentifier)

我使用 PRTG Ipmonitor,它给了我太多关于“请求当前”传感器的请求。我的网站在浏览器中可用。如果删除这个调用服务的页面,一切都会好的。

最佳答案

听起来您没有关闭 WCF 客户端。

我认为正在发生的事情是:

  • 用户调用aspx页面
  • aspx页面调用服务
  • aspx页面返回给用户
  • 服务客户端未关闭,因此请求处于打开状态且当前请求数很高
  • 最终您打开了最大数量的请求
  • 页面等待空闲连接,当它没有获得一个 aspx 页面超时
  • 然后你从超时中得到一个线程中止异常

关于c# - WCF 服务调用中的 "Thread was being aborted",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3812770/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com