Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WCF and WF
  4. WCF is not accepting MaxarrayLength provided

WCF is not accepting MaxarrayLength provided

Scheduled Pinned Locked Moved WCF and WF
helpcsharpdatabasewcfdata-structures
7 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amit Sk Sharma
    wrote on last edited by
    #1

    I have created one windows application to communicate with WCF service. I am providing one array of bytes(saving a file into DB through WCF). It works fine. Issue occures when size of my file exeeds 16KB i.e. 16384(Dafault Max Array length) Issue is I have already set the maxArrayLength to 2147483647 but still application goes with default(16384) and gives me an error.I am puzzeled that from where it's taking this default value when I have made changes in my local app.config. Please do help me if any one knows a walk-through.

    With Thanks & Regards Amit Sk Sharma

    P 1 Reply Last reply
    0
    • A Amit Sk Sharma

      I have created one windows application to communicate with WCF service. I am providing one array of bytes(saving a file into DB through WCF). It works fine. Issue occures when size of my file exeeds 16KB i.e. 16384(Dafault Max Array length) Issue is I have already set the maxArrayLength to 2147483647 but still application goes with default(16384) and gives me an error.I am puzzeled that from where it's taking this default value when I have made changes in my local app.config. Please do help me if any one knows a walk-through.

      With Thanks & Regards Amit Sk Sharma

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      You've made the change to the app.config file? Have you changed the config file at the WCF server end as well? Assuming you are using IIS to host the WCF service, you need to change the web.config file as well. The reason you need to do this is because, ultimately, throttling of bandwidth needs to be in the remit of the server. Suppose you had a service where each client decided on a different arbitrary max limit, and just posted up whatever they wanted. Without server control, you'll probably end up crashing the service.

      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      A 1 Reply Last reply
      0
      • P Pete OHanlon

        You've made the change to the app.config file? Have you changed the config file at the WCF server end as well? Assuming you are using IIS to host the WCF service, you need to change the web.config file as well. The reason you need to do this is because, ultimately, throttling of bandwidth needs to be in the remit of the server. Suppose you had a service where each client decided on a different arbitrary max limit, and just posted up whatever they wanted. Without server control, you'll probably end up crashing the service.

        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

        A Offline
        A Offline
        Amit Sk Sharma
        wrote on last edited by
        #3

        yup! I have defined the same length in web.config also. both app.config and web.config are having same definition for binding and ReaderQuotas. What I feel is my application or WCF service is not able to read values from respective config file as it's working fine with a file upto 16 kb but crashes if file is bigger in size. or else there is some setting in environment which is overriding the values i specified in config files.

        With Thanks & Regards Amit Sk Sharma

        P 1 Reply Last reply
        0
        • A Amit Sk Sharma

          yup! I have defined the same length in web.config also. both app.config and web.config are having same definition for binding and ReaderQuotas. What I feel is my application or WCF service is not able to read values from respective config file as it's working fine with a file upto 16 kb but crashes if file is bigger in size. or else there is some setting in environment which is overriding the values i specified in config files.

          With Thanks & Regards Amit Sk Sharma

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Check to make sure that the value is in the .exe.config file and not just in the app.config file. Typically when you compile your application, the app.config file should get renamed to <<applicationname>>.exe.config in your build directory - check that file.

          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          A 1 Reply Last reply
          0
          • P Pete OHanlon

            Check to make sure that the value is in the .exe.config file and not just in the app.config file. Typically when you compile your application, the app.config file should get renamed to <<applicationname>>.exe.config in your build directory - check that file.

            I'm not a stalker, I just know things. Oh by the way, you're out of milk.

            Forgive your enemies - it messes with their heads

            My blog | My articles | MoXAML PowerToys | Onyx

            A Offline
            A Offline
            Amit Sk Sharma
            wrote on last edited by
            #5

            I chked app.exe.config also, it's fine and having same definition as my app.config.One thing I came to know and tried is to set messageEncoding="Mtom" in place of messageEncoding="Text" in binding. but when I tried to run my application after making this change @ both web and app config files it's giving me error. Content Type multipart/related; type=application/xop+xml";start="";boundary="uuid:4315cc2d-0992-4489-9f75-dffa0515f4c5+id=1";start-info="text/xml" was not supported by service . Theclienyt and service bindings may be mismatch. I tried with Mtom/Text and Text/Mtom combinations also in app/web but same response. Binding definition in my app.config and web.config is as follows: <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IPFCS" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> and the error I am gettign is “The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:objExportLog. The InnerException message was 'There was an error deserializing the object of type PFCSBAL.ExportLog. The maximum array length quota (16384) has been exceeded while reading XML dataThis quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.. Line 1, position 41073.'. Please see InnerException for more details.”

            With Thanks & Regards Amit Sk Sharma

            P 1 Reply Last reply
            0
            • A Amit Sk Sharma

              I chked app.exe.config also, it's fine and having same definition as my app.config.One thing I came to know and tried is to set messageEncoding="Mtom" in place of messageEncoding="Text" in binding. but when I tried to run my application after making this change @ both web and app config files it's giving me error. Content Type multipart/related; type=application/xop+xml";start="";boundary="uuid:4315cc2d-0992-4489-9f75-dffa0515f4c5+id=1";start-info="text/xml" was not supported by service . Theclienyt and service bindings may be mismatch. I tried with Mtom/Text and Text/Mtom combinations also in app/web but same response. Binding definition in my app.config and web.config is as follows: <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IPFCS" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> and the error I am gettign is “The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:objExportLog. The InnerException message was 'There was an error deserializing the object of type PFCSBAL.ExportLog. The maximum array length quota (16384) has been exceeded while reading XML dataThis quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.. Line 1, position 41073.'. Please see InnerException for more details.”

              With Thanks & Regards Amit Sk Sharma

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Well, I'm stumped. If it's set at both ends then it should be honoured. Just as a matter of interest - if you programatically set it just before calling the service, does it get honoured? Try setting it like this:

              Basichttpbinding.ReadersQuoate.MaxStringContentLength = 16384000

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              A 1 Reply Last reply
              0
              • P Pete OHanlon

                Well, I'm stumped. If it's set at both ends then it should be honoured. Just as a matter of interest - if you programatically set it just before calling the service, does it get honoured? Try setting it like this:

                Basichttpbinding.ReadersQuoate.MaxStringContentLength = 16384000

                I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                A Offline
                A Offline
                Amit Sk Sharma
                wrote on last edited by
                #7

                Hi pete! thanks for ur efforts I changed my approach and now savign my large objects by dividing them in byte chunks. although target achieved but am still surprised why it's limiting to 16384 bytes only when I have defined a large amount in my config files. BTW Thanx for your suggestions.

                With Thanks & Regards Amit Sk Sharma

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups