Maximum array length quota

自古美人都是妖i 提交于 2019-11-26 17:42:00

My Bad - I forgot to apply my binding configuration to my endpoint in my server-side config. The server config should read:

<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="NetTcpBinding_ImageResizerServiceContract" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
                maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="2147483647"
                              maxStringContentLength="2147483647"
                              maxArrayLength="2147483647"
                              maxBytesPerRead="2147483647"
                              maxNameTableCharCount="2147483647" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                <security mode="Transport">
                    <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                    <message clientCredentialType="Windows" />
                </security>
            </binding>

        </netTcpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service name="LogoResizer.WCF.ServiceTypes.ImageResizerService" behaviorConfiguration="ServiceBehavior">
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:900/mex/"/>
                    <add baseAddress="net.tcp://localhost:9000/" />
                </baseAddresses>
            </host>
            <endpoint bindingConfiguration="NetTcpBinding_ImageResizerServiceContract" binding="netTcpBinding" contract="LogoResizer.WCF.ServiceContracts.IImageResizerService" />
            <endpoint  address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
</system.serviceModel>

Note the bindingConfiguration="NetTcpBinding_ImageResizerServiceContract" has been added to the netTcp endpoint. My app now works with larger images. Sweet.

Vijay

Please add the <readerQuotas> in binding.

That is the main issue while uploading and downloading the byte[], it solved my problem.

<basicHttpBinding>
    <binding name="ServicesBinding" transferMode="Streamed" maxBufferSize="200000000"
        maxReceivedMessageSize="200000000" messageEncoding="Text"  
        receiveTimeout="00:10:00">
        <readerQuotas maxDepth="2147483647"
            maxStringContentLength="2147483647"
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxNameTableCharCount="2147483647" />
    </binding>
</basicHttpBinding>
Unequip

I utilized the Microsoft SDK SvcConfigEditor. You have this if you use Visual Studio (which has its own version). It is also a free download.

On your hard drive (check both Program Files and Program Files (x86)):

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\SvcConfigEditor.exe

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\SvcConfigEditor.exe

If you have multiple installs of the Microsoft SDK, what version you use will depend on what version of .NET you are developing under. The tool will throw an error to let you know that you tried to open the .dll file under the wrong version.

To use the tool, point to your service’s .dll file and let the tool do the heavy lifting. This is particularly helpful if you have services talking to services (proxies services). Also, keep in mind that you’ll probably need a config setting for both your client (at the application) and server configs (at the webservice).

I was missing a configuration on the server-side endpoint. I had to do two things:

  1. Put an endpoint on my server-side config, configured using SvcConfigEditor
  2. Remember to set the MaxArrayLength in the SvcConfigEditor tool

Also, ASP.NET was being picky about this value, so you might try simplifying your configuration binding and turning it off:

  <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />

it,s working, previously showing reference of net.tcp://myservice.com/Ac_Service.svc/mex when browsing wcf service but now it's http://myservice.com/Ac_Service.svc?wsdl

will it work in future also, without any problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!