What is the maximum size of data can be sent through webservice?

Posted by Prabu_Spark under ASP.NET on 6/18/2014 | Points: 10 | Views : 6793 | Status : [Member] | Replies : 13
Hi sir,
One interviewer asked me, In Webservice, what is the maximum size of data can be sent through webservice. Kindly give me the solution for this problem.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hi Prabhu,
Initially By default, it is possible to send or receive 4MB of data(Maximum). If you want to send more than that, you have to change the maxMessageLength in your web.config file like below.
<configuration>

<system.web>
<httpRuntime maxMessageLength="409600"
executionTimeoutInSeconds="300"/>
</system.web>
</configuration>

From the above change, you will be able to send 400MB of data with maximum time of 300 seconds. After that time, your execution will get stopped as TimeOut.

Hope this helps you.

Thanks

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 6/18/2014 [Member] Starter | Points: 25

Up
0
Down
Hi Goud.Kv,
I added the above line, but it shows "maxMessageLength and executionTimeoutInSeconds" is not allowed. I am using Visual studio 2010. Kindly give me the solution to solve the issue.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Ok Prabhu. Please add <microsoft.web.services3> tag in your web.config file like below,
<configuration>
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
</configuration>

I think it works after this.

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 6/18/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
I added that code, it show errors. I shared my web.config for your reference, kindly check it.


<?xml version="1.0"?>

<configuration>
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<system.web>
<httpRuntime maxMessageLength="409600"
executionTimeoutInSeconds="300"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<compilation debug="true"/>
<customErrors mode="RemoteOnly" defaultRedirect="Error.aspx" redirectMode="ResponseRedirect">
</customErrors>
</system.web>
<connectionStrings>
<add name="con" connectionString="Data Source=192.168.9.12;user id=sa;password=sa;Integrated Security=false;Initial Catalog=test" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>



With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hi Prabhu.,

Please add this section and try again
<configuration>

<microsoft.web.services3>
<messaging>
<executionTimeoutInSeconds value="60" />
<maxMessageLength value="1024" /maxMessageLength>
</messaging>
</microsoft.web.services3>
</configuration>

Please Note that values 60 and 1024 mentioned above are just examples. you can have different

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 6/18/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
I am getting the error as UnRecognised configuration section "microsoft.web.services3 "

With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Replace your web.config file with below code and try,
<?xml version="1.0"?>

<configuration>
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<system.web>
<httpRuntime maxMessageLength="409600"
executionTimeoutInSeconds="300"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<compilation debug="true"/>
<customErrors mode="RemoteOnly" defaultRedirect="Error.aspx" redirectMode="ResponseRedirect">
</customErrors>
</system.web>
<microsoft.web.services3>
<messaging>
<maxMessageLength value="-1" />
</messaging>
</microsoft.web.services3>
<connectionStrings>
<add name="con" connectionString="Data Source=192.168.9.12;user id=sa;password=sa;Integrated Security=false;Initial Catalog=test" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

Setting maxMessageLength value to -1 will disables the data limit.

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 6/18/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
I replaced what u sent. I am getting error as

Unrecognized attribute 'maxMessageLength'. Note that attribute names are case-sensitive.


With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Had you Installed WSE 3.0

You have to install it and apply it in your web.config file.

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 6/18/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
What is WSE? Sorry to ask this, i am not heard about that word. How it is related to webservice?

With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Follow here to do that..
http://msdn.microsoft.com/en-us/library/aa529248.aspx

WSE 3.0 :The Web Services Enhancements (WSE) 3.0 for Microsoft® .NET is an add-on to Microsoft Visual Studio® 2005 and the Microsoft .NET Framework 2.0 that enables developers to build secure Web services based on the latest Web services protocol specifications.

Hope it works after doing this..

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 6/18/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
I am using visual studio 2010, i developed the webservice using framework 4.0, there is no WSE available for Framework 4.0.

[Note: WSE is available for Framework 2 and not for Framework 4]

With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 6/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
I think you can do that manually..
http://www.sanderstechnology.com/?p=10648
http://www.sanderstechnology.com/?p=10659

Thanks & Regards,
Krishna

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response