我在 Azure 上有一个用 Javascript 编写的 NodeJS 应用程序。 app.js
位于根目录中,通过 Git 部署到 Azure 时会自动检测到。
我最近将应用程序转换为带有构建目录的 Typescript,因此根文件现在位于 dist/app.js
中。
在 VS Code 中调试时,我可以轻松更改 launch.json
以指向新位置,但现在将更改推送到 Azure 时,它不再起作用。
如何指定 Azure 的启动文件?
最佳答案
您可以修改web.config
在应用程序的根目录中。
修改<handlers>
标签:
<handlers>
<!-- Indicates that the app.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="/dist/app.js" verb="*" modules="iisnode"/>
</handlers>
修改重写模式:
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="dist\app.js"/>
</rule>
关于javascript - 更改 Azure 上 NodeJS 应用程序的初始文件位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39229296/