将 Angular Universal 部署到 IIS [英] Deploy Angular Universal to IIS

查看:29
本文介绍了将 Angular Universal 部署到 IIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 web.config 中,我在将 Node.js 部署到 IIS 时遇到问题:

I am having a problem deploying my Node.js to the IIS, in my web.config:

> <handlers>
>         <add name="iisnode-ng-universal" path="dist/server.js" verb="*" modules="iisnode" />
>     </handlers>

 <rule name="ng-universal" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{HTTP_HOST}" pattern="test" />
        </conditions>
        <action type="Rewrite" url="dist/server.js" />
    </rule>

我收到此错误:

图片

这是我的网络文件树的样子:

This how my web files tree looks:

网络文件

我试图给予 IIS_IUSRSIUSR 完全权限,但它似乎不起作用.就像这篇文章建议的那样:iisnode 在处理请求时遇到错误

I tried to give full permission to IIS_IUSRS and IUSR but it does not seem to work. Like this post suggested: iisnode encountered an error when processing the request

推荐答案

你能试试下面的代码吗..它对我有用

can you try the below code.. it works for me

<?xml version="1.0" encoding="utf-8"?>


<configuration>
    <system.webServer>        
      <handlers>
        <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
      </handlers>
      <rewrite>
        <rules>
            <rule name="DynamicContent">
                 <match url="/*" />
                 <action type="Rewrite" url="server.js"/>
            </rule>
       </rules>
      </rewrite>
    </system.webServer>
  </configuration>

你的 server.js 可以在 dist 文件夹之外.

Your server.js can be outside the dist folder.

这篇关于将 Angular Universal 部署到 IIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆