错误:Web Api中此流上不支持超时

时间:2014-11-18 22:21:31

标签: c# asp.net-web-api

我有一个api控制器从Web服务接收大量数据并将其转换为JSON。 当它获取更大的数据包时,会发生错误:

Timeouts are not supported on this stream

我的控制器非常简单:

public class ChangesPickupController : ApiController
{

    [HttpPost]
    public ChangeStructure[] GetChangesPickup(string id, int page, int toPage, UserInfoStructure uis)
    {
        var manager = new CkpClientManager();

        try
        {
            var dt = DateTime.ParseExact(id, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);

            using (var client = manager.GetClient())
            {
                return client.GetChanges(uis, dt, page, toPage);
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("ERROR: " + ex.Message);
            throw new Exception(ex.Message);
        }
    }
}

你有任何线索,可能是什么问题?我应该更改某些地方的流媒体属性或什么?

提前致谢,JiKra

编辑:

嗯,这是我的堆栈:

Server stack trace:
at System.IO.Stream.get_ReadTimeout()
at System.ServiceModel.Channels.DelegatingStream.get_ReadTimeout()
at System.ServiceModel.Channels.DelegatingStream.get_ReadTimeout()
at System.ServiceModel.Channels.HttpInput.WebResponseHttpInput.WebResponseInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.ServiceModel.Channels.MessageEncoder.BufferMessageStream(Stream stream, BufferManager bufferManager, Int32 maxBufferSize)
at System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType)
at System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream)
at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(HttpRequestMessage httpRequestMessage, Exception& requestException)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.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)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at CkpSelfHost3.CkpWs.ICkpWS.GetChangesPickup(UserInfoStructure UserInfo, DateTime Datum, Int32 Strana, Int32 NaStranu)
at CkpSelfHost3.CkpWs.CkpWSClient.GetChangesPickup(UserInfoStructure UserInfo, DateTime Datum, Int32 Strana, Int32 NaStranu) in C:\Users\krakora\documents\visual studio 20
Host3\CkpSelfHost3\Service References\CkpWs\Reference.cs:line 2576
at CkpSelfHost3.Controllers.ChangesPickupController.GetChangesPickup(String id, Int32 page, Int32 toPage, UserInfoStructure uis) in C:\Users\krakora\documents\visual studio 2
fHost3\CkpSelfHost3\Controllers\ChangesPickupController.cs:line 30

1 个答案:

答案 0 :(得分:0)

嗯,问题出在供应商的网络服务提供商一边。 ZIKR