anglar配備はiis出現404ソリューションについて詳細に説明する。
angglarアプリケーションはiis上に展開され、リフレッシュは404出現する。
ソリューション:
iis URL Rewriteモジュールをインストールして、urlrewriteを配置します。
srcディレクトリにweb.com figを追加した内容は以下の通りです。
angglar-cli.jsonファイルを変更します(anglar 2-5) https://github.com/WeihanLi/TechNotes/issues/16 https://stackoverflow.com/questions/43785928/angular-2-hosted-on-iis-http-error-404 https://blogs.msdn.microsoft.com/premier_developer/2017/06/14/tips-for-running-an-anglar-ap-i-iis/ 以上が本文の全部です。皆さんの勉強に役に立つように、私たちを応援してください。
ソリューション:
iis URL Rewriteモジュールをインストールして、urlrewriteを配置します。
srcディレクトリにweb.com figを追加した内容は以下の通りです。
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
web.co nfigを設定して自動的に包装します。angglar-cli.jsonファイルを変更します(anglar 2-5)
"apps": [
{
"root": “src”,
"ourDir": “dist”,
"assets": [
“assets”,
“favicon.ico”,
“web.config”
],
angglar.jsonファイルを修正します。
“build”: {
"options”: {
. . .
"assets": [
“src/assets”,
“src/favicon.ico”,
“src/web.config”
],
Reference