开发者

Trying to run WEBrick for Rails application, but keep getting error: "Only one usage of each socket..."

Info: Rails 3.0.9; Ruby 1.8.7; Windows 7

I just switched from mysql to postgresql in my Rails environment, and I cannot for the life of me get around this error when trying to run rails s on port 3000:

WARN TCPServer Error: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)

I'm developing back and forth between two computers using dropbox, and everything works just fine on my home computer. But at work, this issue is driving me crazy.

I've researched this question all over the internet, and I don't feel any of the answers have applied. The obvious answer is that the port is occupied. But I can't identify anything in my processes or using netstat in the command prompt that would be using this port.

This link http://oldwiki.rubyonrails.org/rails/pages/MysteryProcessHoldsOntoWebrickPort describes my problem exactly, but none of the solutions have worke开发者_运维百科d. I've tried changing the port to 3001 using the -p option, but then I get this error:

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "???" and accepting TCP/IP connections on port 5432?

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "???" and accepting TCP/IP connections on port 5432?

This same message also appears if I try to run rake db:migrate.

So aside from the methods I've already mentioned, I have no idea how identify and remedy the cause of this error.

I'm somewhat new to programming, so I may be overlooking something. Any help would be much appreciated.


I just had a very similar version of your problem. Rake db:migrate didn't migrate, it ran and gave no errors or migrating msgs. , the problem seemed to be a discrepancy between rake 9.2.2 and rake 8.7 abbr. If u run bundle exec rake db:migrate , it may work but didn't not in my case. I ran sudo gem uninstall rake and the bundle install. It still didn't work. I uninstalled pg 8.7 and reinstalled pg 9.1.1 using homebrew and opened a new RoR file with --freeze and that file rake db:migrates ... But I can't validate in the model. The Validation throws a 500 internal server error - string can't be coerced to integer. The reason I mention all this is because I have just migrated computer to Mac lion and to postgresql. Changing computers we are both. It seems connecting postgresql is the common thread among these errors. A lot differing opinions about where to put pg files and how best to configure ... I'm on 5432 btw , saves, queries , just don't validate

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜