ASP.NET: HTTP Post Enabled Web Service

Today I had to create a web service that allowed another company to send information to us on a regular basis and they requested that they be able to send the information by using an HTTP Post rather than a SOAP request. I created the web service and tested it locally using a simple form and all went smoothly but when I deployed it to our production server, I was not able to perform and HTTP Post to the service. Turns out that be default, ASP.NET web services are only able to be called using an HTTP Post when it is on the local machine.

If you need to enable HTTP Post calls to your web service in a production environment, simply add an entry for HttpPost to the system.web -> webServices -> protocols node of the web.config.

Similarly, if you do not want to support HTTP Post calls, just add a remove entry for HttpPost in the same location.

This change can also made in the machine.config file if you want global results.

Posted in ASP.NET. Tags: . 4 Comments »

4 Responses to “ASP.NET: HTTP Post Enabled Web Service”

  1. Markus Says:

    where is this file located? I just want the client to be able to post a file to a directory. Do we need an ASP page to handle this?

    • Nick Olsen Says:

      The web.config file should be located in the root directory of your application. But if I understand correctly, this post has nothing to do with what you want to do. You should do a search for ‘ASP.NET file upload’ to give you more direction on how to allow users to upload files to your website.

  2. Markus Says:

    We are using IIS 6

  3. Prodis a.k.a. Fernando Hamasaki de Amorim Says:

    It works for me.
    Thank you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: