我在Azure中运行Node.js应用程序,并尝试获取如下配置设置:

var azure = require('azure');

azure.RoleEnvironment.getConfigurationSettings(function(error, settings) {
   if (error) {
      console.log(error);
      return;
   }

   console.log('Settings: %s', settings);
});

但是输出始终是这样的:
{ "code": "ENOENT", "errno": "ENOENT", "syscall": "connect", "fileName": "\\\\.\\pipe\\WindowsAzureRuntime" }

我正在使用所有最新位的IISNode在IIS中运行Node.Js。如果我在Azure VM(即node.exe server.js)上手动运行 Node ,也会遇到相同的错误。在Azure Development Fabric中在我的PC上运行时也是如此。

在此先感谢您的帮助或建议!

最佳答案

既然您提到您正在IISNode中运行,则它必须是Web角色。请注意SDK readme中的以下内容:

关于javascript - 无法从Node.js中读取Azure配置设置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12612894/

10-09 20:29
查看更多