我一直在尝试在azure devops项目服务上部署next.js应用程序。
我已经设置了我的项目的CI和CD,该CD和与Azure仓库有关。 即使我的管道成功,即使应用程序在本地运行良好,我也会收到“内部服务器错误”或“应用程序错误”的消息。
我尝试了一个节点applicaton,它与相同的pipleline任务一起运行。
我尝试添加一个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"/>-->
即使我认为我已经完成了几乎整个过程,我的应用程序端点仍会给出应用程序错误结果。