Accessing a asmx service from windows-forms gives max request length error

左心房为你撑大大i 提交于 2019-12-08 12:16:14

问题


I try to upload a file using asmx service from windows forms. I have specified max request length in web.config where asmx service is hosted. The service works well when i try to upload a file from a web form where asmx service is hosted.

Now the issue is when i try to upload a file using windows forms it gives me max request length error.

The code of app.config of windows application is as:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="MySiteServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="655360000" maxBufferPoolSize="5242880000" maxReceivedMessageSize="655360000"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="81920000" maxArrayLength="163840000"
                    maxBytesPerRead="40960000" maxNameTableCharCount="163840000" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://mysite2.mydomain.com/mysiteservice.asmx"
            binding="basicHttpBinding" bindingConfiguration="MySiteServiceSoap"
            contract="MySiteService.MySiteServiceSoap" name="MySiteServiceSoap" />
    </client>

</system.serviceModel>

I increase the size of maxbufeerlenth etc but it does not work.

The file i am trying to upload is of size 7 MB only

For smaller files (of less than 1 MB) there is no problem.

One more point i want to add is i add a service in windows forms as a "ADD SERVICE REFERENCE WIZARD".

Any help is appreciated.


回答1:


This is an issue with IIS configuration for Request Limits

this Q&A Add row using jquery helps you

and this is http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits where you find more detailed information



来源:https://stackoverflow.com/questions/7872582/accessing-a-asmx-service-from-windows-forms-gives-max-request-length-error

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