Saturday, November 30, 2019

Web Config file for Angular App



Web Config File for Angular App

when you release Angular app on production then web.config file is needed for URL Rewriting .
you can add a text file and change it file type as configuration web.config

web.Config

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

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

Note : if you are running IIS 10 then remove   <match url=".*" />  as <match url="." />


@ShubhTechnoExpet on Facebook page .

Build Angular app for Production


Build Angular App for Production


while you plan for production release then keep these things in Mind

ng build --prod --base--href /vdname/

above command will create a production build in your app folder . a dist folder will be added in your app folder with name "dist".

This dist folder will have all build files .

Note1 : keep in mind that vdname and your actual vd name where you will do the deployment always                   will be the same .
suppose your hosting address is http://www.xafdeveloper.blogspot.com
then while making build you need to create build like this .

ng build --prod --base--href   /xafdeveloper/

Note2: URL Rewrite extension need to install in IIS and you can download it from Microsoft site .

Note3: you need to add web.config file in your vd as by default angular build didn't create a                                   "web.config" file .

you can create is by adding a text file and change its name and file type as config .
now copy url rewrite code from web and paste it in this file .
Now access your app and enjoy Angular Application Cheers !..
Note3. you can see base reference details in Index.html file also in your build folder


@ShubhTechnoExpet on Facebook page .