简体   繁体   English

如何在IISNode上初始化koa node.js应用程序应用程序(Azure网站)

[英]How to initialize a koa node.js app application on IISNode (Azure WebSites)

We are currently moving a self-hosted koa app to IISNode on Azure WebSites.. 我们目前正在将自托管的koa应用程序移至Azure WebSite上的IISNode。

In self-hosting, we initiallize the application by calling node --harmony ./bin/application Requests then go to ./index.js. 在自托管中,我们通过调用node --harmony ./bin/application请求来初始化应用程序,然后转到./index.js。

However we could not find how to setup IISNode to call "bin/application" at initialization time. 但是,我们找不到如何在初始化时将IISNode设置为调用“ bin /应用程序”。

Any ideas? 有任何想法吗? Thanks 谢谢

Not sure this is the same scenario, but I ran into something that sounds like this when express.js started using ./bin/www as the entry point for express.js apps. 不确定这是否是同一场景,但是当express.js开始使用./bin/www作为express.js应用程序的入口点时,我遇到了类似的情况。 Initially it broke everything, but now we look for the "scripts" entry in the package.json to tell Azure how to configure IISNode for the application. 最初它破坏了一切,但现在我们在package.json中查找“脚本”条目,以告诉Azure如何为应用程序配置IISNode。 For express, it generates a "scripts" entry that looks like this: 为了进行快速表达,它将生成一个类似于以下内容的“脚本”条目:

"scripts": { "start": "node ./bin/www" }, “ scripts”:{“ start”:“ node ./bin/www”},

When Azure sees this, it generates a web.config on the server that uses ./bin/www for the entry point. 当Azure看到此消息时,它将在使用./bin/www作为入口点的服务器上生成一个web.config。

So... I'd say first off, try adding a "scripts" entry to the package.json that points to your ./bin/application file, and try deploying that to Azure. 所以...我首先要说,尝试在指向您的./bin/application文件的package.json中添加“脚本”条目,然后尝试将其部署到Azure。 Hopefully that 'just works'. 希望“行之有效”。 If it doesn't, try adding a web.config to the root of your application, using https://gist.github.com/Blackmist/8677359708fd30779c77 as the contents. 如果不是这样,请尝试使用https://gist.github.com/Blackmist/8677359708fd30779c77作为内容,将web.config添加到应用程序的根目录。 This should point IISNode to the ./bin/application file as the entrypoint, and is what Azure Websites should automatically generate when it sees the "scripts" entry in the package.json file. 这应将IISNode指向./bin/application文件作为入口点,这是Azure网站在package.json文件中看到“脚本”条目时应自动生成的内容。

The other problem you'll run into is using Node.js v0.11.13, which I don't believe is included in Azure websites by default, and passing the --harmony switches. 您将遇到的另一个问题是使用Node.js v0.11.13(默认情况下我不认为它包含在Azure网站中)并传递--harmony开关。 http://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/ has a section on including a version of node.js as part of your website. http://azure.microsoft.com/zh-cn/documentation/articles/nodejs-specify-node-version-azure-apps/包含有关将node.js版本作为网站一部分的内容。 In the iisnode.yml file, you'd want to have a line similar to the following: 在iisnode.yml文件中,您需要具有类似于以下内容的行:

nodeProcessCommandLine: d:\\home\\site\\wwwroot\\bin\\node.exe --harmony nodeProcessCommandLine:d:\\ home \\ site \\ wwwroot \\ bin \\ node.exe --harmony

I believe this should make this work. 我相信这应该使这项工作。

You can setup custom deployment scripts for Azure Websites. 您可以为Azure网站设置自定义部署脚本。

This blog post contains details on how to use it: http://blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1/#.VBcrnPldXIc 此博客文章包含有关如何使用它的详细信息: http : //blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1/#.VBcrnPldXIc

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

相关问题 在 IISNode 上运行的 Azure Node.js 应用程序中未定义端口 - Port being undefined in the Azure Node.js application running on IISNode 如何通过Azure网站上的Node.js应用程序将大文件的上传流通过管道传输到Azure Blob存储? - How to pipe upload stream of large files to Azure Blob storage via Node.js app on Azure Websites? 使用IISNode的Windows Azure IIS上的Node.js:如何设置节点检查器调试器? - Node.js on Windows Azure IIS using IISNode: How to setup node-inspector debugger? 使用IISNode的Windows Azure IIS上的Node.js:如何设置启动文件? - Node.js on Windows Azure IIS using IISNode: How to set startup file? node.js:如何使用koa护照 - node.js: How to use passport with koa 如何准备 KOA/Node.js 进行生产? - How to prepare KOA / Node.js for production? Node.JS 应用程序将在 localhost 上运行,但不会通过 iisnode 在 URL 上运行 - Node.JS application will run on localhost but not URL via iisnode 网址路由在iisnode的我的node.js应用程序中不起作用 - Url routing not working in my node.js application with iisnode node.js应用程序未使用iisnode自动更新 - node.js app not auto-updating with iisnode 基于Node.js + Express的应用程序未运行iisnode - Node.js + Express based app not running with iisnode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM