发送请求 URI 为“/”的 POST 请求;到 Cassini Web 服务器导致 405 错误。为什么?
我使用 HTTPWebRequest 从客户端向配置为接受远程请求的远程计算机上的 Cassini Web 服务器发送 POST 请求。但是,我没有指定文件作为 URL 的一部分。我将请求直接发送到服务器,如“http://172.34.142.12:8080/” 。但是,我无法收到正确的响应并收到“405 Method not allowed”错误。我使用的是卡西尼号 3.5。关于为什么会发生这种情况有什么建议吗?
I am sending a POST request using HTTPWebRequest from the client to the Cassini Web Server on the remote machine configured to accept remote requests. But, I am not specifying a file as part of the URL. I am sending the request directly to the server as in "http://172.34.142.12:8080/". However, I am unable to receive a proper response and getting a "405 Method not allowed" error. I am using Cassini 3.5. Any suggestions as to why this might be happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的公司生产了一款名为 Neokernel 的产品,它可能会对您有所帮助: www.neokernel.com
Neokernel 不是 基于卡西尼号。它是一个专业的、可嵌入的 ASP.NET Web 服务器,位于一个小型、独立的程序集中,具有日志记录、SSL、对多个 ASP.NET 应用程序的支持、编程配置、对虚拟目录的支持,并且它可以运行 IIS 执行的任何 Web 应用程序。它还可以与 Mono 框架配合使用;我们开发它是因为卡西尼号(以及由此衍生的各种项目)存在许多问题。
My company makes a product called the Neokernel that might help you: www.neokernel.com
The Neokernel is NOT based on Cassini. It is a professional, embeddable ASP.NET web server in a small, self contained assembly with logging, SSL, support for multiple ASP.NET apps, programmatic configuration, support for virtual directories, and it runs any web app that IIS does. It also works with the Mono framework; we developed it because there are a number of problems with Cassini (and the various projects derived from it).
Cassini 被硬编码为不接受来自运行它的主机以外的任何主机的请求。出于安全原因,它是这样编程的。
如果您确实需要此功能,则必须构建您自己的版本。有一些关于如何执行此操作的演练,这里是一个。
Cassini is hardcoded to not accept requests from any host other than the one running it. It's programmed this way for security reasons.
If you really need this functionality, you'll have to build your own version of it. There's a few walkthroughs around on how to do this, here's one.