简体   繁体   English

当计算机连接到Internet时,无法将Rails-project连接到本地主机

[英]Can't connect Rails-project to localhost when computer is connected to internet

I just recently begun having the problem that I'm only able to visit localhost:3000 when wifi is turned off and computer is disconnected from the internet. 我最近才开始遇到这样的问题,当wifi关闭并且计算机与Internet断开连接时,我只能访问localhost:3000

As soon as I turn on wifi and connect the computer to an internet connection, chrome just says "connecting" in bottom left corner of browser window. 一旦我打开wifi并将计算机连接到Internet连接,Chrome就会在浏览器窗口的左下角说“正在连接”。 There are no errors present. 没有错误。

I've tried on three completely different connections. 我尝试了三种完全不同的连接。 Home wifi, office and hotspotting via phone. 家庭wifi,办公室和通过电话进行热点接入。

I have also tried on several different Rails-projects, both rails 5 and below. 我还尝试了5个及以下的Rails项目。 So it doesn't seem to be project-related. 因此,它似乎与项目无关。

I have also tried booting the server using my computers IP address as well as 0.0.0.0, and as well as on a different port than :3000. 我也尝试过使用计算机的IP地址以及0.0.0.0以及不同于:3000的端口来引导服务器。 I've also tried in different browsers. 我也在不同的浏览器中尝试过。

If it is to any use: 如果有任何用途:

=> Booting Puma
=> Rails 5.0.1 application starting in development on http://xxx.xx.xx.x:3000
=> Run `rails server -h` for more startup options
[Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
Puma starting in single mode...
* Version 3.7.0 (ruby 2.2.4-p230), codename: Snowy Sagebrush
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

Observation: 观察:

This error does not affect rendering partials asynchronously inside the view. 此错误不会影响视图内异步渲染局部视图。 That is as smooth and quick as it use to be. 就像过去一样流畅和快捷。 This only happens when trying to go from projects/:id/edit to projects/new for instance. 例如,仅当尝试从projects/:id/edit转到projects/new ,才会发生这种情况。

If, as you say, there are no errors and AJAX calls are working smoothly, I'd say that you are using an asset that is fetched from the internet but is not available right now. 如您所说,如果没有错误并且AJAX调用运行正常,那么我想说您正在使用从Internet上获取但目前不可用的资产。 While the internet is working, the application will keep waiting for a response from the remote server. 互联网正常运行时,应用程序将继续等待远程服务器的响应。

When you disconnect from the internet and load the page, see if you get any errors in the browser console about failing to fetch something and try removing it from your application. 当您断开与互联网的连接并加载页面时,请查看浏览器控制台中是否出现有关未能获取某些内容并尝试将其从应用程序中删除的错误。 Let me know if this turns out to be your issue. 让我知道这是否是您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM