惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
P
Privacy International News Feed
L
LINUX DO - 最新话题
博客园_首页
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
C
Cisco Blogs
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
罗磊的独立博客
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
A
About on SuperTechFans
G
GRAHAM CLULEY
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
D
DataBreaches.Net
The Hacker News
The Hacker News
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
I
InfoQ
T
The Exploit Database - CXSecurity.com
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 叶小钗
Project Zero
Project Zero

博客园 - guofu

Python爬虫之BeautifulSoap的用法 pip使用豆瓣的镜像源 Django Media URL 文件上传 配置 Android 中的 Service 全面总结 【转】IT 圈里有哪些经常被读错的词? Android开发的技术层次 ubuntu下安装oracle 网站框架策划时的小技巧--页面原型篇 中国电商价格欺诈何时休? Mac OS X上如何实现到Linux主机的ssh免登陆[forward] 25个必须记住的SSH命令[forward] 详细介绍ORACLE sqlplus命令(转) Oracle 数据库导入导出命令 JAVA学习网站收集 解决Eclipse中ISO8859-1 字符集的方法 Windows 如何在cmd命令行中查看、修改、删除与添加环境变量 Bugzilla安装过程 有关ant的faq Win7或Windows server 2008中IIS7支持ASP+Access解决方法
"The test form is only available for requests from the local machine"解决方法
guofu · 2013-02-21 · via 博客园 - guofu

最近刚写service,部署起来以后出现上述问题,想想肯定也有很多人碰到类似问题,一起来解决掉吧!

原因:
NET Framework 1.1 定义了一个名为 HttpPostLocalhost 的新协议。默认情况下,这个新协议处于启用状态。该协议允许从与使用 HTTP POST 请求的 Web 服务位于同一计算机上的应用程序调用该服务。允许的前提条件是:POST URL 使用 http://localhost,而不是 http://hostname。这使得 Web 服务开发人员可以使用基于 HTML 的测试窗体,从 Web 服务所在的同一计算机调用该 Web 服务。

当您尝试从远程计算机访问 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:
<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: <protocols><add name="HttpSoap"/><add name="HttpPost"/><add name="HttpGet"/><add name="HttpPostLocalhost"/><!-- Documentation enables the documentation/test pages --><add name="Documentation"/></protocols>