How to deploy angular 4 app to azure web app using local git

I'm trying to deploy too much. I can deploy nodeJS in an azure web application, but I cannot deploy Angular4. It always shows "service unavailable." How to deploy it with local git. (Development team using git for the management version)

+4
source share
2 answers

You need to include the Web.config file in the root folder of your project.

Web.config:

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <system.web>
            <httpRuntime maxQueryStringLength="32768" maxUrlLength="65536" />
        </system.web>
        <system.webServer>
            <security>
                <requestFiltering>
                    <requestLimits maxQueryString="32768" />
                    </requestFiltering>
            </security>
            <rewrite>
                <rules>
                    <rule name="AngularJS" stopProcessing="true">
                        <match url="^(?!.*(.chunk.js|.bundle.js|.bundle.map|.bundle.js.gz|.bundle.css|.bundle.css.gz|.png|.jpg|.ico)).*$" />
                        <conditions logicalGrouping="MatchAll"></conditions>
                        <action type="Rewrite" url="/" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
0
source

Did you first create your application? For example, if you use angular-cli using:

ng build --prod

dist, . , web.config dist:

<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".json" mimeType="application/json" />
            <remove fileExtension=".woff"/>
            <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
            <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
     </staticContent>

      <rewrite>
        <rules>
            <rule name="Angular" 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>

dist -. git dist

git init

, :

git add -A 

:

git commit -m "initial commit"

- azure web git:

git remote add azure https://<username>@localgitdeployment.scm.azurewebsites.net:443/localgitdeployment.git

:

git push azure master

. git Azure App Service

0

Source: https://habr.com/ru/post/1693266/


All Articles