在远程访问 Cassini中的应用程序会遇到403错误
出现这种情况是因为,Cassini中Request.cs文件中第93行中以一段代码,这一段代码就限制了Cassini只能用于本地,将这一段代码注释掉之后,就可以Cassini服务于远程机器了
// Limit to local requests only
if (!_conn.IsLocal) {
_conn.WriteErrorAndClose(403);
return;
}
Take a look in Request.cs about line 93, in method Process().
In my copy (from the Cassini in a Service sample), there is an if statement limiting requests to being local, and returning 403 if not. Comment out this if statement and it should serve remotely as well as localhost.
Also, look at Host.cs about line 199, in method Start(), where the _socket.Bind(...) call is.
Be sure it is bound to IPAddress.Any to serve more than localhost.
I would expect something similar in the .NET 2.0 version of the source.
-Jesse Chisholm
另外使用Cassini服务于WebService还可能出现这种情况,"测试窗体只能用于来自本地计算机的请求"
出现这种情况,的解决办法是
The test form is only available for requests from the local machine.
在web.config中加入如下配置节内容
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>