"The test form is only available for requests from the local machine" solution

Source: Internet
Author: User
I have just written about the service. The above problems will occur after deployment. I think many people may encounter similar problems. Let's solve them together! Cause:
NET Framework 1.1 defines HttpPostLocalhost. By default, this new protocol is enabled. This protocol allows applications on the same computer as the Web service that uses the http post request to call this service. The precondition is that the post url is used. Http: // localhostInstead Http: // 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.