Recently, a new colleague has just written about the service. After the service is deployed, the above problems may occur. Think about it. Many people may have encountered similar problems. Let's solve them together!
Cause:
Net Framework 1.1 definesHttppostlocalhost. By default, this new protocol is enabled. This protocol allows applications from the same computer as Web services that use http post requestsProgramCall this service. The precondition is that the Post URL is used.Http: // localhostInsteadHttp: // hostname. This allows web service developers to use HTML-based test forms to call the Web service from the same computer where the Web Service is located.
When you try to access the Web service from a remote computer, the "call" button is not displayed. In addition, you will receive the following error message:
The test form is only available for requests from the Local Machine
Solution:
1. You can enable http get and http post by editing the Web. config file of the vroot where the Web Service is located. The following configurations enable both http get and http post:
<Configuration>
<System. Web>
<WebServices>
<Protocols>
<Add name = "httpget"/>
<Add name = "httppost"/>
</Protocols>
</WebServices>
</System. Web>
</Configuration>
2. Edit the <protocols> section in machine. config to enable these protocols for all web services on the computer. In the following example, http get, http post, and soap are enabled, and http post is also enabled from the local host:
<Protocols> <Add name = "httpsoap"/> <Add name = "httppost"/> <Add name = "httpget"/> <Add name = "httppostlocalhost"/> <! -- Documentation enables the documentation/test pages --> <Add name = "documentation"/> </protocols>