INFO: HTTP GET and HTTP POST Are Disabled by Default
http://support.microsoft.com/default.aspx?scid=kb;en-us;819267
INFO: HTTP GET and HTTP POST Are Disabled by Default
Article ID | : | 819267 |
Last Review | : | April 24, 2003 |
Revision | : | 1.0 |
SUMMARY
This article discusses changes in the .NET Framework 1.1 that affect the HTTP GET method and the HTTP POST method on a Web server. This article also describes workarounds for this new functionality.
MORE INFORMATION
The .NET-connected Web services support HTTP GET, HTTP POST and SOAP protocols. By default, in .NET Framework 1.0, all three protocols are enabled. By default, in .NET Framework 1.1, HTTP GET and HTTP POST are both disabled. This is for security reasons.
Applications that use HTTP GET or HTTP POST to invoke a Web service fail when the Web service is upgraded to .NET Framework 1.1. These applications receive a
Note that the HTML-based test form uses HTTP POST, and therefore the HTML-based test form does not work in .NET Framework 1.1. This is true except on localhost as noted below.
The .NET Framework 1.1 defines a new protocol that is named HttpPostLocalhost. By default, this new protocol is enabled. This protocol permits invoking Web services that use HTTP POST requests from applications on the same computer. This is true provided the POST URL uses http://localhost, not http://hostname. This permits Web service developers to use the HTML-based test form to invoke the Web service from the same computer where the Web service resides.
When you try to access the Web service from a remote computer you do not see the Invoke button. And, you receive the following error message:
Applications that use HTTP GET or HTTP POST to invoke a Web service fail when the Web service is upgraded to .NET Framework 1.1. These applications receive a
System.Net.WebException
error message that indicates the request format is unrecognized.Note that the HTML-based test form uses HTTP POST, and therefore the HTML-based test form does not work in .NET Framework 1.1. This is true except on localhost as noted below.
The .NET Framework 1.1 defines a new protocol that is named HttpPostLocalhost. By default, this new protocol is enabled. This protocol permits invoking Web services that use HTTP POST requests from applications on the same computer. This is true provided the POST URL uses http://localhost, not http://hostname. This permits Web service developers to use the HTML-based test form to invoke the Web service from the same computer where the Web service resides.
When you try to access the Web service from a remote computer you do not see the Invoke button. And, you receive the following error message:
The test form is only available for requests from the local machine
Workaround
HTTP GET and HTTP POST may be enabled by editing the Web.config file for the vroot where the Web service resides. The following configuration enables both HTTP GET and HTTP POST:
<configuration> <system.web> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices> </system.web> </configuration>Alternatively, you can enable these protocols for all Web services on the computer by editing the <protocols> section in Machine.config. The following example enables HTTP GET, HTTP POST, and also SOAP and HTTP POST from localhost:
<protocols> <add name="HttpSoap"/> <add name="HttpPost"/> <add name="HttpGet"/> <add name="HttpPostLocalhost"/> <!-- Documentation enables the documentation/test pages --> <add name="Documentation"/> </protocols>
REFERENCES
For more information about Web services configuration, see the <protocols> Element in the .NET Framework 1.1 documentation: http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfprotocols.asp (http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfprotocols.asp)
分类:
.net 1.1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现