大网数据广告活动
Web服务器与PHP

Disable documentation protocol for ASP.NET

· 52CE 我爱测

This article describes how to disable the documentation protocol for ASP.NET web services.

This article describes how to disable the documentation protocol for ASP.NET web services.

Original product version:   ASP.NET
Original KB number:   815149

Summary

ASP.NET Web services facilitate the development of Web services clients by automatically generating documentation that describes how to communicate with the web service. Web services that have the documentation protocol enabled generate an HTML-formatted page when a browser request is received. This HTML-formatted page describes the following information:

  • The operations that are supported
  • The parameters that each operation accepts
  • The type of data that should be passed in this parameters

The documentation protocol also generates an XML-formatted Web Services Description Language (WSDL) file. This file is designed to allow applications to understand how to structure requests to the Web service.

This information can be useful to developers, especially developers who create clients for public Web services. However, revealing detailed information about the functionality of private Web services increases the risk that the Web service will be misused by a malicious attacker. The documentation protocol always describes all functions and parameters of a Web service even if only a subset of those functions are intended to be publicly accessible.

Remove the documentation protocol

To disable the documentation web services protocol for an ASP.NET application, follow these steps:

  1. Open the web.config file from the web application's root directory in a text editor (for example, Notepad). If the web.config file doesn't exist, create a web.config file for the ASP.NET Application.

  2. Add the <webServices> configuration element to the system.web element in the web.config file.

  3. In the <webServices> element, add the <protocols> configuration element.

  4. In the <protocols> element, add the remove name="Documentation" element.

    The following example shows the <webServices> configuration element added to a web.config file to disable the automatic generation of browser-friendly documentation:

    <webServices>
        <protocols>
            <remove name="Documentation"/>
        </protocols>
    </webServices>
    
  5. Save the web.config file.

References

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 04/08/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。