After the service is deployed to the server, the "The test form is only available for requests from the Local Machine" solution appears.

Source: Internet
Author: User
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.