托管Angular 4应用后出现HTTP错误500.19-内部服务器错误

5

我已经将我的Angular 4应用程序托管在服务器系统中,最初我遇到了404错误,所以我添加了一个web.config文件到我的生产构建文件夹中。现在我得到了这个错误。

但是应用程序在我的本地系统上运行良好,在服务器系统上抛出错误。我尝试了一些其他运行在Win7、Win10上的系统,但它不会一直显示500.19的错误。

我花了几个小时来解决这个问题,在stackoverflow上参考了所有与我的帖子相关的帖子,但没有什么作用。

有人能帮我解决这个问题吗?

错误页面:

enter image description here

Web.Config

<configuration>
<system.webServer>
    <rewrite>
      <rules>
        <rule name="AngularJS Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
          </conditions>
          <action type="Rewrite" url="/eCommerceWebsite" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
1个回答

19

问题已经解决,现在出现了另一个问题:“'Access-Control-Allow-Origin'头包含多个值'http://localhost, *',但只允许一个。因此,源'http://localhost'不允许访问。” @penlechann - Vinil
这与您的API服务器有关,与Angular无关。 - penleychan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接