First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

Imagine you developed an ASP.NET WebService, but the client that needs to use it wants to call it using HTTP POST instead of SOAP.

As default, when accessed from the localhost, all webservices listen both to SOAP and HTTP POST calls, but if accessed from another host they listen only to SOAP.

My friend Google found a page on the MSDN site that explains how to change the protocols accepted by the ASP.NET runtime to listen to web services calls.

As all configuration settings it can be changed both at machine level (machine.config) and per single application inside the web.config.

The configuration section is named <webServices> and is inside the <system.web> section.

The default configuration (the one that is inside a newly installed machine.config) is the following:

<system.web>
    ...
    <webServices>
        <protocols>
              <add name="HttpSoap"/> 
              <!-- <add name="HttpPost"/> --> 
              <!-- <add name="HttpGet"/>  -->
              <add name="Documentation"/>
              <add name="HttpPostLocalhost"/>
        </protocols>
    </webServices>
    ...
</system.web

Option names are quite self explaining. So, in order to enable allow HTTP POST calls, all you need is to uncomment the HttpPost in the machine.config or add <add name="HttpPost"/> in your application web.config

posted on Friday, December 22, 2006 12:14 AM

Comments on this entry:

# re: How to enable an ASP.NET WebService to listen to HTTP POST calls

Left by Dave Frank at 12/22/2006 6:44 AM

Assuming that your API doesn't do anything fancy and you don't need to transmit any complex types...

# re: How to enable an ASP.NET WebService to listen to HTTP POST calls

Left by Josh at 1/11/2007 7:40 AM

This was very helpful for 1.1. But does anyone know how to accomplish this in .Net 2.0?

I've tried making the same edits specified to my machine.config and web.config in the C:\windows\microsoft.net\framework\v2.0.50727\CONFIG directory as well as to the web.config in the application's directory.

Any advice?

Thanks

# re: How to enable an ASP.NET WebService to listen to HTTP POST calls

Left by Simone Chiaretta at 1/11/2007 8:58 PM

No, never tried it with ASP.NET 2.0

# How to enable an ASP.NET WebService to listen to HTTP POST calls in .NET 2.0

Left by Rene at 9/3/2007 12:32 PM

Hi,
thanks for this post. In .NET 2.0 try to modify web.config which goes with your webservice. In my case works well. Thanks again.
Rene

# re: How to enable an ASP.NET WebService to listen to HTTP POST calls

Left by Andy Shellam at 9/7/2007 2:47 PM

Thanks for the article - worked a treat!

In response to Josh - I've accomplished this in .net 2.0 but I made the change in the application's web.config.

# re: How to enable an ASP.NET WebService to listen to HTTP POST calls

Left by Wally at 9/13/2007 9:05 AM

Could anyone still explain how it works in .Net 2.0 .
I tried it in the machine.config AND web.config but without any positive result?
Thanks in advance..

# re: How to enable an ASP.NET WebService to listen to HTTP POST calls

Left by james.x at 11/2/2007 10:17 AM

You must attention the .NET version you are using,and change the machine.config in the correct directory.

Comments have been closed on this topic.