前提条件:安装iis的电脑
准备条件:
1.下载iisnode 地址https://github.com/tjanczuk/iisnode/wiki/iisnode-releases 安装
2.下载URL Rewrite 地址http://www.iis.net/downloads/microsoft/url-rewrite 安装
3.地址 https://www.cnblogs.com/vipp/p/9145932.html,前9步骤搭建node站点
4.新建iis网站,设置如下
开始设置:
在node站点下新建web.config配置文件,内容如下:然后点击最下面图片所示位置进行访问。
<configuration> <system.webServer> <!-- indicates that the hello.js file is a node.js application to be handled by the iisnode module --> <handlers> <add name="iisnode" path="index.js" verb="*" modules="iisnode" /> </handlers> <!-- use URL rewriting to redirect the entire branch of the URL namespace to index.js node.js application; for example, the following URLs will all be handled by index.js: http://localhost/foo http://localhost/bar --> <rewrite> <rules> <rule name="main"> <match url="/*" /> <action type="Rewrite" url="index.js" /> </rule> </rules> </rewrite> <!-- exclude node_modules directory and subdirectories from serving by IIS since these are implementation details of node.js applications --> <security> <requestFiltering> <hiddenSegments> <add segment="node_modules" /> </hiddenSegments> </requestFiltering> </security> </system.webServer> </configuration>
原文地址:https://www.cnblogs.com/vipp/p/9168301.html
时间: 2024-10-19 05:35:43