How to: Disable the Service Help Page for a Web Service

This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation.

Navigating in a Web browser to the URL for the Web service without any parameters produces an HTML help page, if the page is enabled (which it is by default in a server's machine.config file). The service help page and its configuration are further discussed in Configuration Options for XML Web Services Created Using ASP.NET.

To disable the service help page for an individual Web application

  1. Open the Web.config file in the root directory of the Web application with your favorite editor. (If a Web.config file does not exist, create one.)

  2. Modify the webServices section of Web.config to explicitly remove the Documentation protocol.

    <webServices>
         <protocols>
           <remove name="Documentation" />
         </protocols>
    </webServices>
    
  3. Save Web.config.

    This configuration change will take effect on the next request to a Web service hosted by the Web application.

    Note

    Removing the Documentation protocol also disables WSDL file generation for any Web services within the Web application. This prevents clients from generating a proxy class unless a custom WSDL file is created and provided for them. To leave WSDL file generation on for Web services within a Web application, but not provide any human readable information regarding the Web services, you can add an <wsdlHelpGenerator> element to the Web.config file for the Web application and set the href attribute to a blank HTML page you have created. The following code example is an excerpt of a Web.config file that sets the service help page to a MyBlank.htm file in the docs folder beneath the folder containing the Web.config file.

    <webServices>
       <wsdlHelpGenerator href="docs/MyBlank.htm"/>
    </webServices>
    

See Also

Tasks

How to: Disable Protocol Support for Web Services
How to: Enable Discovery for XML Web Services

Concepts

Configuration Options for XML Web Services Created Using ASP.NET
Deploying XML Web Services

Other Resources

XML Web Services Using ASP.NET