我正在关注使用Socket.IO在Azure Cloud Service上部署Node.js聊天应用程序的this教程。我没有使用教程中提供的聊天示例,而是编写了自己的一些改进和其他功能,但整体结构基本相同。
一切正常,我还使用模拟器测试了我的应用程序,它按预期工作。但是,我似乎无法正确地在Azure服务上发布它。
我输入了以下cmdlet:
Publish-AzureServiceProject -ServiceName mychatapp0323 -Location "East US" -Launch
以下是我收到的消息:
PS C:\node\chatapp\WorkerRole1> Publish-AzureServiceProject -ServiceName mychatapp0323 -Location "East US" -Launch
WARNING: Publishing mychatapp0323 to Microsoft Azure. This may take several minutes...
WARNING: 12:02:17 AM - Preparing runtime deployment for service 'mychatapp0323'
WARNING: 12:02:17 AM - Verifying storage account 'mychatapp0323'...
WARNING: 12:02:52 AM - Preparing deployment for mychatapp0323 with Subscription ID:
0xxxxx8-xxx2-4xxe-8xx8-8xxx67xxxxx0...
WARNING: 12:04:22 AM - Connecting...
WARNING: 12:04:24 AM - Creating...
WARNING: 12:04:26 AM - Created hosted service 'mychatapp0323'.
WARNING: 12:04:27 AM - Uploading Package to storage service mychatapp0323...
WARNING: 12:04:58 AM - Starting...
WARNING: 12:06:04 AM - Created Deployment ID: 13df765e37e840cdb54a998498ab1745.
WARNING: 12:06:04 AM - Initializing...
WARNING: 12:09:06 AM - Instance WorkerRole1_IN_0 of role WorkerRole1 is busy.
Publish-AzureServiceProject : An error occurred while sending the request.
At line:1 char:1
+ Publish-AzureServiceProject -ServiceName mychatapp0323 -Location "Eas ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Publish-AzureServiceProject], HttpRequestException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.CloudService.PublishAzureServiceProjectCommand
自从我输入cmdlet以来至少2小时后没有出现错误消息,并且它在此行停留了很长时间(超过一小时):
WARNING: 12:09:06 AM - Instance WorkerRole1_IN_0 of role WorkerRole1 is busy.
知道为什么会这样吗?我写的聊天应用程序可以找到here。
答案 0 :(得分:0)
我带了你的应用程序并在我的本地环境中构建它。它没有像预期的那样工作。我认为以下内容会引发您的问题:
1)请考虑将您的dependencies
npm模块更新为最新版本。
2)在server.js
文件中,您需要ip
和mongodb
个模块,但尚未将它们包含在dependencies
部分中。
所以我将dependencies
文件中的package.json
更改为如下所示,然后才有效。
"dependencies": {
"express": "^4.15.2",
"jade": "^1.11.0",
"nib": "^1.1.2",
"socket.io": "^1.7.3",
"stylus": "^0.54.5",
"ip": "^1.1.5",
"mongodb": "^2.2.25"
}