1

I got the fortune to further develop an in-house console application written in C#. The purpuse of this application is to synchronize multiple files from one server to another, basically copy files from one to the other. The application works for files up to 4 MB and I can't find it anywhere in the application itself that limits the filesize to 4 MB other than for the log file.

This console application is apart of a webapplication that stores forms that the users have created. I have managed to limit the webapplication to allow files no bigger than 100 MB in size and that works but the synchronization application won't transfer the bigger files from the depot to their respective places on the other server.

Unfortunately I have no other log than the one that says the files (that aren't over 4 MB) where transfered OK. Debugging the application is a no go since it only runs on the server and I can't get it to work on my local machine.

My question is thus, is there any posibility to set anything in the app.config file to allow the application to also synchronize files bigger than 4 MB?

In the webapplication part of this big project I have used the following code:

<system.web>
    <httpRuntime maxRequestLength="102400" executionTimeout="1200"/>
</system.web>

But since this part isn't a webapplication it (appears) to not care about that line of configuration.

This is the configuration file for the console synchronization application:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="SynchConfiguration" value="C:\Documents and Settings\My Documents\Visual Studio 2010\Projects\DepotSynch\Depot.Synch\DepotSynchConfiguration.xml"/>
        <add key="SynchLog"  value="C:\Documents and Settings\My Documents\Visual Studio 2010\Projects\DepotSynch\Depot.Synch\DepotSynchLOG.txt"/>
        <!-- Int Size in MB -->
        <add key="MaxLogFileSize" value="4"/>

        <!-- SHS Web Service API Configuration -->
        <add key="Status" value="test"/>
        <add key="From" value="1234567890"/>
        <!-- Identification Nummer -->
        <add key="To"  value="1234567890.web"/>
        <add key="CertLocation" value="certificate\test\test.p12"/>
        <!-- placeing of certet i filsystemet -->
        <add key="CertPwd" value="test234test"/>
        <!-- cert -->
        <!-- <add key="ShsUrl" value="Is set ini DepotSynchConfiguration.xml for each environment"/> -->
        <!-- URL to Shs Service -->
        <add key="ConnectByCertAndPwd" value="true"/>
        <!-- True/False - for certificate -->
        <add key="SendFileBySHS" value="false"/>
        <!-- For test. Won't send the file/s. -->
    </appSettings>

    <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="MyWsHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
                </security>
            </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:50232/Depot.svc"  binding="wsHttpBinding" bindingConfiguration="MyWsHttpBinding" contract="DepotReleaseServiceReference.IDepot" name="MyWsHttpBinding">
                <identity>
                    <servicePrincipalName value="&#xD;&#xA;          " />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

Unfortunately I can't go and ask the original developer for help in this matter since he quit working here some 2 years ago.

DLeh
  • 23,806
  • 16
  • 84
  • 128
Ullman
  • 21
  • 4
  • Take a look at this question, it seems to be similar: http://stackoverflow.com/questions/11068612/wcf-service-maxreceivedmessagesize-basichttpbinding-issue. – Nathan Taylor Jan 26 '15 at 14:57
  • Thanks for the tips and link to the similar page, I tried that you linked @NathanTaylor but it didn't work, however I don't say it's wrong but I will try and restart the server that runs this service to see if it will take the new app.config file instead of a chached one. – Ullman Jan 27 '15 at 09:13
  • Hi and thanks for the help and input @Nathan please see my comment in the answer below :) – Ullman Feb 12 '15 at 08:50

1 Answers1

0

I have a web application and here is how I solved my issue, put this line of code under in your config file

<system.webServer>
  ...
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="2147483647" />
    </requestFiltering>
  </security>
</system.webServer>

[Edited] Also please take a look at this topic

The maximum string content length quota (8192) has been exceeded while reading XML data

Community
  • 1
  • 1
Michael Samteladze
  • 1,310
  • 15
  • 38
  • I will try it but I'm not too sure if it will work as it is not a webapplication. – Ullman Jan 27 '15 at 11:38
  • I have come to realize a bit of embarrassing info, the synchronization was working all along, the problem was that the synchronization application was depending on a certain flag to be set on the files for it to actually synchronize it from the server they are uploaded to and to the next server where they later should be at. Since this application is using the other servers service as well the 4 MB limit has already been dealt with on that end so it all works now. Thank you @Michael for all your input and help :) – Ullman Feb 12 '15 at 08:49