在IIS中部署angular 5应用程序 [英] Deploy angular 5 app in IIS

查看:284
本文介绍了在IIS中部署angular 5应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图在本地IIS中托管一个角度应用程序。除非直到使用浏览器的刷新按钮,否则它工作正常。点击刷新按钮后出现404.0错误。



我尝试过:



观看各种网站后,我在文件夹中添加了一个web.config文件



Hi,

I was trying to host an angular application in local IIS. It is working fine unless until use is hitting the refresh button of the browser. After hitting the refresh button it is getting an 404.0 error.

What I have tried:

After watching various sites I have added a web.config file in the folder

<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="/ePortal" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>





ePortal is只是IIS中我的应用程序名称。



添加此内容后,我收到500.19错误。





ePortal is just the name of my application name in IIS.

After adding this I am getting 500.19 error.

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.





虽然我我正在做ng-serve它工作得非常好。我还试过在angular-cli.json中的assets标签中添加web.config文件。什么都行不通。



有谁可以告诉我该怎么做?



While I am doing ng-serve it is working absolutely fine. I have also tried by adding the web.config file in assets tag in angular-cli.json. Nothing is working.

Can anybody tell me what to do?

推荐答案

iis - ASP.NET:HTTP错误500.19 - 内部服务器错误0x8007000d - 堆栈溢出 [< a href =https://stackoverflow.com/a/18788068/124386target =_ blanktitle =新窗口> ^ ]:

错误0x8007000d表示URL重写模块(在web.config)缺失或未安装正确版本。

Error 0x8007000d means URL rewriting module (referenced in web.config) is missing or proper version is not installed.



您需要安装URL重写模块:

URL重写:官方Microsoft IIS站点 [ ^ ]


这篇关于在IIS中部署angular 5应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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