Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

HOW TO: Limit the Web Services Protocols that a Server Permits


View products that this article applies to.

Summary

This step-by-step article describes how to limit the protocols that a Web service supports.

XML�based Web services exchange XML documents to communicate. This exchange can occur across any type of application-layer protocol. By default, ASP.NET Web services are exposed through four different protocols: HttpSoap, HttpPost, HttpGet, and Documentation. In many cases, only a subset of these four protocols is required. For example, Web services typically use only the HttpSoap protocol for communications. In these circumstances, if you remove the unused protocols, you increase the security of the application by decreasing the attack surface. This article describes how to disable Web services protocols that are used to communicate with an ASP.NET application.

Disable Web Services Protocols

To disable a Web Services protocol for an ASP.NET application, follow these steps:
  1. Open the Web.config file in a text editor (such as Notepad). The Web.config file is located in the root folder of you Web service application.
  2. Add the <webServices> configuration element under the <system.web> element.
  3. In the <webServices> element, add the <protocols> configuration element.
  4. In the <protocols> element, add a <remove> element for each default protocol that you want to disable.
  5. In each of the <remove> elements that you created in step 4, set the name attribute to the name of a protocol that you want to disable.
  6. By default, the HttpPost, HttpSoap, HttpGet, and Documentation protocols are enabled. The following example of the <webServices> configuration element disables all default protocols except HttpSoap:
    <webServices>
        <protocols>
            <remove name="HttpPost"/> 
            <remove name="HttpGet"/> 
            <remove name="Documentation"/> 
        </protocols>
    </webServices>
  7. Save the Web.config file. The Web service will restart automatically, and will return error messages for all requests that are in disabled protocols.

↑ Back to the top


References

For more information, visit the following Microsoft Web sites: For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
815179 HOW TO: Create the Web.config File for an ASP.NET Application
815178 HOW TO: Edit the Configuration of an ASP.NET Application
818014 HOW TO: Secure Applications That Are Built on the .NET Framework

↑ Back to the top


Keywords: KB815150, kbhowtomaster, kbconfig, kbwebservices, kbwebforms

↑ Back to the top

Article Info
Article ID : 815150
Revision : 8
Created on : 5/13/2007
Published on : 5/13/2007
Exists online : False
Views : 507