473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Configuring maxRequestLength for windows client application


Given a web service method defined like this :

[WebMethod]
public string EchoByteArray(byte[] data)
{
return data.Length.ToString() + " bytes received";
}

If, from a Windows C# app, I call this web method with a 5000 Kbyte array,
I get an exception such as :

Exception : System.Web.Services.Protocols.SoapException -
System.Web.Services.Protocols.SoapException:
There was an exception running the extensions specified in the config
file. --->
System.Web.HttpException: Maximum request length exceeded. at
System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.get_InputStream()
at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context,
HttpRequest request, HttpResponse response, Boolean& abortProcessing)

==
Now, I can change the maxRequestLength attribute in httpRuntime element in
machine.config,
and this makes the code work (since default is 4096 KBytes).

Is it possible to configure maxRequestLength in the application's config
file ?
(Remember that this is a Windows client app).
I tried changing the the <myappname>.exe.config file with settings which
looked
like this :

<configuration>
<system.web><httpRuntime maxRequestLength="50000"/>
</system.web>
</configuration>

but it seems to have no effect on the app - the setting seems to
get ignored completely.

Any ideas ?
TIA,
Stephen

Nov 21 '05 #1
3 23835
"Stephen Ahn" <noaddress_at_noaddress.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
System.Web.HttpException: Maximum request length exceeded. at
System.Web.HttpRequest.GetEntireRawContent() : : Now, I can change the maxRequestLength attribute in httpRuntime element in
machine.config,
and this makes the code work (since default is 4096 KBytes).

Is it possible to configure maxRequestLength in the application's config
file ?


No, the HTTP Runtime that's being configured is on the server.
The server is oblivious to the configuration files on it's clients.

It would rather undermine the point of allowing server admins to
specify a maxRequestLength (that point being to prevent DoS
attacks whereby miscreants tie up a server by submitting large
requests) if any hacker could simply set a larger value on their
client and bypass the server's setting, wouldn't it? :-)

Talk to the administrator of the server to increase the setting;
or re-design your requests to fit within your alloted bandwidth
by breaking the data up into chunks across multiple requests
and re-assembling them on the other end.
Derek Harmon
Nov 21 '05 #2

"Derek Harmon" <lo*******@msn.com> wrote in message
news:e$**************@TK2MSFTNGP12.phx.gbl...

No, the HTTP Runtime that's being configured is on the server.
The server is oblivious to the configuration files on it's clients.


Thanks, now it makes sense.
I was getting confused, because I was testing on a PC which was
both the client and the server. Changing the machine.config file
on this PC had the desired affect, but I was thinking this
was effecting the client app, and not the server. (Obviously,
this was wrong).
Nov 21 '05 #3
You can set it in the web.config file with:
<httpRuntime maxRequestLength="8000"></httpRuntime>

The above will set it to 8 mb
Given a web service method defined like this :

[WebMethod]
public string EchoByteArray(byte[] data)
{
return data.Length.ToString() + " bytes received";
}

If, from a Windows C# app, I call this web method with a 5000 Kbyte array,
I get an exception such as :

Exception : System.Web.Services.Protocols.SoapException -
System.Web.Services.Protocols.SoapException:
There was an exception running the extensions specified in the config
file. --->
System.Web.HttpException: Maximum request length exceeded. at
System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.get_InputStream()
at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context,
HttpRequest request, HttpResponse response, Boolean& abortProcessing)

==
Now, I can change the maxRequestLength attribute in httpRuntime element in
machine.config,
and this makes the code work (since default is 4096 KBytes).

Is it possible to configure maxRequestLength in the application's config
file ?
(Remember that this is a Windows client app).
I tried changing the the <myappname>.exe.config file with settings which
looked
like this :

<configuration>
<system.web><httpRuntime maxRequestLength="50000"/>
</system.web>
</configuration>

but it seems to have no effect on the app - the setting seems to
get ignored completely.

Any ideas ?
TIA,
Stephen


User submitted from AEWNET (http://www.aewnet.com/)
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings...
10
by: Ed Stevens | last post by:
A tale of woe, and a question . . . Last week my boss said to me "we've installed DB2 Connect on this Solaris box. Make it work." Now, I've barely seen DB2 Connect on Windows, having fumbled...
2
by: Peter Row | last post by:
Hi, To allow users to upload files larger than 4MB in size I added: <httpRuntime maxRequestLength="102400" executionTimeout="600" /> ...to my web.config file. Fair enough this works fine....
25
by: moondaddy | last post by:
I have an application where users need to upload images and in my web.config file I have a setting like this: <httpRuntime maxRequestLength="512" /> Which restricts image larger than 500k from...
1
by: Joseph Geretz | last post by:
I've been using the following (client-side) configuration block to allow WSE/DIME transfer of files larger than 4 meg: <messaging> <maxRequestLength>-1</maxRequestLength> </messaging> (Of...
1
by: Joseph Geretz | last post by:
I've been using the following (client-side) configuration block to allow WSE/DIME transfer of files larger than 4 meg: <messaging> <maxRequestLength>-1</maxRequestLength> </messaging> (Of...
2
by: Joseph Geretz | last post by:
I'm developing a Web Service using DIME to download and upload files from and to an IIS server. In order to increase the download filesize to unlimited, I have the following block in my App.config...
0
by: salty | last post by:
I'm running into the notorious 4MB upload limit. I see where one answer is to set a higher limit to the httpRunTime MaxRequestLength setting in web.config. However this affects the whole...
0
by: nbSean | last post by:
I am working with a windows app that calls a web service to upload a file to a server. Had a problem with the file size, so I increased maxRequestLength in the web.config of the web service: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.