热衷于使用 Nextjs 项目部署 IIS

问题描述 投票:0回答:1

我想在 IIS 上部署 Next.js 项目。我已经安装了 IISNode 和 URL Rewriter。我已经更新了 web.config 和 server.js 文件。我编辑了 web.config 中的 nodeProcessCommandLine 部分,但仍然收到屏幕截图中显示的错误。你能帮我吗?

WebConig;

`

    <!-- 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>
      <add segment="node_modules"/>
    </hiddenSegments>
  </requestFiltering>
</security>

<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />
<iisnode node_env="production"/>
<!--
  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"/>-->
`

无论我做什么,我都无法解决它。你能帮我吗?

iis next.js iisnode
1个回答
0
投票

一切都可以与 httpplatformhandler 配合使用。但是,页面现在没有 CSS 样式,并且我的 NextJs 应用程序中的 API 路由似乎被排除在部署之外。有什么见解吗?

© www.soinside.com 2019 - 2024. All rights reserved.