当尝试从远程计算机访问 Web 服务时,不会显示“调用”按钮。并且会收到以下错误信息:
The test form is only available for requests from the local machine
解决方法:
1.通过编辑 Web 服务所在的 vroot 的 Web.config 文件,可以启用 HTTP GET 和 HTTP POST。以下配置同时启用了 HTTP GET 和 HTTP POST:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
<
configuration
>
< system.web >
< webServices >
< protocols >
< add name ="HttpGet" />
< add name ="HttpPost" />
</ protocols >
</ webServices >
</ system.web >
</ configuration >
< system.web >
< webServices >
< protocols >
< add name ="HttpGet" />
< add name ="HttpPost" />
</ protocols >
</ webServices >
</ system.web >
</ configuration >
2.通过编辑 Machine.config 中的 <protocols> 节为计算机上的所有 Web 服务启用这些协议。下面的示例启用了 HTTP GET、HTTP POST 及 SOAP,此外还从本地主机启用了 HTTP POST:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
<
protocols
>
<
add
name
="HttpSoap"
/>
<
add
name
="HttpPost"
/>
<
add
name
="HttpGet"
/>
<
add
name
="HttpPostLocalhost"
/>
<!--
Documentation enables the documentation/test pages
-->
<
add
name
="Documentation"
/>
</
protocols
>