views:

142

answers:

2

I have developed a WCF WebService. On client side they are unable to send more than 8kb of file bytes[]. How can I increase the number of bytes the client and upload and also the time out.

<system.serviceModel>
    <!-- Test File Size  -->
    <binding maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" >
    </binding>

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
        <services>
            <service name="WcfSmartConnect.Service1" behaviorConfiguration="WcfSmartConnect.Service1Behavior">
                <!-- Service Endpoints -->
                <endpoint address="" binding="wsHttpBinding" contract="WcfSmartConnect.IService1">
                    <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="WcfSmartConnect.Service1Behavior">
                    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                    <serviceMetadata httpGetEnabled="true"/>
                    <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                    <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
+1  A: 

add this to the endpiont tag:

bindingconfiguration="wsHttp"

than add this complete binding config tag inside your system.serviceModel tag

<binding name="wsHttp" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" >
</binding>
the_ajp
Darn it. Every time I try to answer someones question today, some new guy beats me to it :) +1
wcm
It is still throwing this error![WebException: The remote server returned an error: (500) Internal Server Error.] System.Net.HttpWebRequest.GetResponse() +5373789 System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +57
Pinu
I have also add my webconfig , could you please check if i need to make any more changes to it???
Pinu
@wcm hehe sorry :P (I'm faster than my own shadow :P) I'm not that new anymore just not fast enough most of the time. @Pinu edit your web.config with the wcf configuration editor. look for the values I posted above. You can't just paste this in there you need to suplement your own binding configuration with it. :). I'll post a better explaination tommorow
the_ajp
+1  A: 

Maybe not a direct answer but for large files you really should be looking at MTOM or streaming.

Henk Holterman