azure - 我无法在 azure 上部署我的 nextjs 应用程序
问题描述
我一直在尝试在 azure devops 项目服务上部署我的 next.js 应用程序。
我已经设置了与 azure repos 链接的项目的 CI 和 CD。即使我的管道成功,我也会收到“内部服务器错误”或“应用程序错误”,即使应用程序在我的本地运行良好。
我尝试了一个节点应用程序,它运行相同的管道任务。
我已经尝试添加一个 web.config 文件,但仍然没有运气。
谁能建议我我可以错过什么?
添加 web.config 文件 在发布管道中禁用 web.config 选项 在管道中添加新任务,例如 npm run build
我的 web.config 文件如下:
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />
<!--
You can control how Node is hosted within IIS using the following options:
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
* node_env: will be propagated to node as NODE_ENV environment variable
* debuggingEnabled - controls whether the built-in debugger is enabled
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
我的应用程序端点给出了应用程序错误结果,即使我认为我已经完成了几乎整个过程。
解决方案
推荐阅读
- c# - 在 C# 中使用 SQL
- python - 绘制来自调查的分组信息
- c++ - 如何在 ncurses c++ 中从屏幕获取文本?
- javascript - 调用 setState 后的事件给了我以前的状态值
- html - EJS 文件未按预期呈现
- javascript - window.onhashchange 会在单页应用程序上检测除导航以外的任何内容吗?
- java - Spring会话在会话超时后创建新会话而不进行身份验证
- python - 用于字符串表达式的递归括号解析器
- sql - 使用 Convert() 将 nvarchar 值“3.5”转换为数据类型 int 时转换失败
- angular - Angular Mat-table 扩展和折叠未按预期工作