Running nodejs/MEAN app on IIS virtual directory setup

大城市里の小女人 提交于 2021-02-08 10:22:17

问题


I am running my MEAN app on windows. So far I was running the application on Non-Sucking Service Manager as a windows service. Now we need to enable windows authetication and we are planning to use IIS.

We are planning to use IISNode for this. So far I have read this post.

I installed the samples that comes with IISNode by running setupsamples.bat file. running this file typically creates a virtual directory @ C:\Program Files\iisnode\www

I want to understand If I need to run my application, Do I always need to copy all the content under C:\Program Files\iisnode\www folder? Or I can create a new virtual directory and make it work ?


回答1:


I answered a similar question to this here

IISNode allows you operate your Node.js app just like you would any other application in IIS. Just make sure you have IISNode, Node.js, and the Url Re-write Module installed on the environment as well as a Web.config for your app and you should be good to go. Without the URL Re-write module then you would have to go to http://host:port/app.js/ instead of http://host:port and IISNode takes advantage of it to accomplish this.

In that thread I have a template Web.config that I use with all my IISNode services/web apps. It will support all aspects of hosting in IIS, including hosting your app in a Virtual Directory. Just make sure that the main file for your app matches the main file referenced in the config file within the URL Re-writing section.

If you are using VS then I recommend downloading the Node.js Tools for Visual Studio. It helps with creating the Web.config that you need for IISNode.



来源:https://stackoverflow.com/questions/31558394/running-nodejs-mean-app-on-iis-virtual-directory-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!