Results 1 to 2 of 2

Thread: WCF System.InsufficientMemoryException

  1. #1

    Thread Starter
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    WCF System.InsufficientMemoryException

    Getting this error when calling my WCF service. The service is streaming a 150mb file. It usually works the first time I call it, even the second, then I start getting the error.

    error message : Failed to allocate a managed memory buffer of 268435456 bytes. The amount of available memory may be low.

    I don't event know exactly where that number (268435456) comes from. Here is my config.

    Code:
    <?xml version="1.0"?>
    <configuration>
        <system.serviceModel>
          <client>
            <endpoint address="http://localhost:53761/StreamService.svc"
              binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStreamService"
              contract="StreamService.IStreamService" name="BasicHttpBinding_IStreamService" />
            <endpoint address="http://localhost:53761/ProgressService.svc"
              binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProgressService"
              contract="ProgressService.IProgressService" name="BasicHttpBinding_IProgressService" />
          </client>
          <bindings>
            <basicHttpBinding>
              <binding name="BasicHttpBinding_IStreamService" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647" transferMode="StreamedResponse">
                <security mode="TransportCredentialOnly" />
              </binding>
              <binding name="BasicHttpBinding_IProgressService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                  <transport clientCredentialType="None" proxyCredentialType="None"
                    realm="" />
                  <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
              </binding>
            </basicHttpBinding>
          </bindings>        
        </system.serviceModel>
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
    Searched on google but found mostly nothing
    Thanks for any help.
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

  2. #2

    Thread Starter
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: WCF System.InsufficientMemoryException

    in case it could help here's the stack trace:

    Code:
    System.Runtime.Fx.AllocateByteArray(Int32 size)
    System.Runtime.InternalBufferManager.PooledBufferManager.TakeBuffer(Int32 bufferSize)
    System.Runtime.BufferedOutputStream.AllocNextChunk(Int32 minimumChunkSize)
    System.Runtime.BufferedOutputStream.WriteCore(Byte[] buffer, Int32 offset, Int32 size)
    System.Runtime.BufferedOutputStream.Write(Byte[] buffer, Int32 offset, Int32 size)
    System.Xml.XmlStreamNodeWriter.FlushBuffer()
    System.Xml.XmlUTF8NodeWriter.WriteBase64Text(Byte[] buffer, Int32 offset, Int32 count)
    System.Xml.XmlUTF8NodeWriter.WriteBase64Text(Byte[] trailBytes, Int32 trailByteCount, Byte[] buffer, Int32 offset, Int32 count)
    System.Xml.XmlBaseWriter.WriteBase64(Byte[] buffer, Int32 offset, Int32 count)
    System.Xml.XmlDictionaryWriter.WriteValue(IStreamProvider value)
    System.ServiceModel.Dispatcher.StreamFormatter.Serialize(XmlDictionaryWriter writer, Object[] parameters, Object returnValue)
    System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter writer, MessageVersion version, Object[] parameters, Object returnValue, Boolean isRequest)
    System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
    System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
    System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
    System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
    System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer)
    System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
    System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
    System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
    System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
    System.ServiceModel.Channels.HttpRequestContext.OnReply(Message message, TimeSpan timeout)
    System.ServiceModel.Activation.HostedHttpContext.OnReply(Message message, TimeSpan timeout)
    System.ServiceModel.Channels.RequestContextBase.Reply(Message message, TimeSpan timeout)
    System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.Reply(MessageRpc&amp; rpc)
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width