開發環境
- nodejs: v10.15.3
- windows: 10
- iis: 10
需求:
用Nodejs開發了服務端,要部署到IIS
需要在IIS服務器上安裝iisnode,結果遇到問題:安裝不上
記錄一下針對以上問題的調查結果解決方案:
解決過程:
-
1、 通過 Web Platform Installer 安裝 IISNode for IIS,結果失敗。
原因:本機 IIS 10.0,報錯:需要 IIS 7.x
很明顯不可能去改用 IIS 7.x -
2、 下載 msi 安裝包直接安裝
path: Azure/iisnode
-
3、 安裝完成后,查看 Web Platform Installer 里也相應的變為已安裝了。
-
4、 IIS 中新建站點,配置 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="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="myapp">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
解決過程中發現網上有人遇到同樣問題,但沒有找到解決辦法,
在某雲網站上的提問問題下,為了貼上自己的回答,特意現注冊了下。。。
