使用浏览器测试Webservers服务时出现提示“The test form is only available for requests from the local machine.”的解决办法

刚刚写了一个Webservice,并将其部署到了服务器的IIS上,在客户机调用的时候发现调用按钮不见了,并提示”The test form is only available for requests from the local machine.(测试表单仅对来自本地机器的请求可用。)“。如下图: 

又尝试了在服务器上运行,发现按钮是有的: 

解决方法:

通过编辑 Web 服务所在的 根目录的 Web.config 文件,可以启用 HTTP GET 和 HTTP POST。如下配置同时启用了 HTTP GET 和 HTTP POST:

<system.web>
    <webServices>
        <protocols>
          <add name="HttpGet"/>
          <add name="HttpPost"/>
        </protocols>
    </webServices>
</system.web>

猜你喜欢

转载自blog.csdn.net/qq_39569480/article/details/84964481