- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我按照 RailsTutorial.org 第三版(刚刚发布的版本)中的说明安装了 Rails 4.2.0.beta2。我没有使用 cloudIDE,而是在带有 RVM 的 Windows 7 主机上通过 Vagrant 使用 Ubuntu Trusty 32。
rails _4.2.0.beta2_ new hello_app
然后粘贴到 his gemfile sample 中。
在那之后,我跑了:
$ bundle install
$ rails s
服务器启动正常,但是当我尝试连接到 localhost:3000
时,出现“找不到服务器”
更奇怪的是,我还有几个其他的 Rails 入门项目,我一直在使用 Rails 4.0.3 和 4.1.6,我能够很好地连接到那里的服务器。
我在这里错过了什么?为什么当我使用最新版本创建新 Rails 项目时我的浏览器无法连接,但它在旧版本上运行良好?
此外,我尝试了 wget http://0.0.0.0:3000
并在连接并收到 200 响应时未指定长度,而在旧版本下的另一个全新 Rails 应用程序中,我会得到任何 index.html
的实际文件大小。
最佳答案
关于无法访问的服务器,来自 Rails 4.2 release notes :
3.3 Default host for rails server
Due to a change in Rack, rails server now listens on localhost instead of
0.0.0.0
by default. This should have minimal impact on the standard development workflow as bothhttp://127.0.0.1:3000
andhttp://localhost:3000
would continue to work as before on your own machine.However, with this change you would no longer be able to access the Rails server from a different machine (e.g. your development environment is in a virtual machine and you would like to access it from the host machine), you would need to start the server with
rails server -b 0.0.0.0
to restore the old behavior.If you do this, be sure to configure your firewall properly such that only trusted machines on your network can access your development server.
127.0.0.1:3000
将仅允许来自端口 3000 上的该地址的连接,而 0.0.0.0:3000
将允许来自任何 端口 3000 的地址。
由于 Rails 4.2 默认只接受来自 localhost 的连接,你只能从 localhost 访问服务器(例如在 VM 内);来自另一台机器(例如 VM 的主机)的连接将不起作用。
您必须使用上述“旧行为”方法来允许来自 VM 主机的连接。
关于未指定的内容长度,这取决于所使用的网络服务器。我假设它使用的是不发送内容长度的分块编码。 Assets 将有内容长度,但没有 HTML。
关于ruby-on-rails - Rails 4.2.0.beta2 - 无法连接到 LocalHost?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26570609/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!