Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Deploy ASP.NET Core with Angular #3486


User avatar
0
bilalhaidar created

Hello, Is it possible to keep the Angular and Core apps separate and develop instead of combining them both in one app?

How would then I deploy the app to IIS?

One more question, what are the databases available for the Core/Angular?

Thanks Bilal


15 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Bilal,

    ASP.NET Core and Angular project is designed seperately. Because of that, you can deploy it seperately.

    *.Web.Host project is deployed just like any other ASP.NET web project. Angular project is deplyed using angular-cli <a class="postlink" href="https://github.com/angular/angular-cli">https://github.com/angular/angular-cli</a>. You basically need to run "ng build --prod" command on command promt when you are in th root of angular project. It publishes website in dist folder.

    ASP.NET Core version uses Entity Framework Core and you can use databases that EF Core supports. SQL Server and My Sql are possible as far as I know, I haven't tried with others but you can check EF Core's documents for that.

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Thanks @ismcagdas :-)

    Excuse my questions as I am starting with Core and Angular 2. I wanna move to those 2 technologies quickly.

    Once I get a deployed version of the angular app, on IIS, how to place files inside an App?

    Thanks

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Following deployment guide hepls you. <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Angular#deployment">https://aspnetzero.com/Documents/Develo ... deployment</a>

  • User Avatar
    0
    bilalhaidar created

    Thanks. The documentation explains only how to deploy Angular 2, how about asp.net core? How can we deploy it in this case?

  • User Avatar
    0
    alirizaadiyahsi created

    You can follow microsoft documents to deploy your project. <a class="postlink" href="https://docs.microsoft.com/en-us/aspnet/core/publishing/iis">https://docs.microsoft.com/en-us/aspnet ... ishing/iis</a>

  • User Avatar
    0
    bilalhaidar created

    Thanks!

    So eventually I need to place Angular 2 files inside the Asp.net Core app to be hosted under IIS?

  • User Avatar
    0
    alirizaadiyahsi created

    Do you want to merge Host and AngularUI and one publish/deployment?

  • User Avatar
    0
    bilalhaidar created

    Frankly I don't know! If possible to explain to me the possibilities in hosting ASP.NET Core + Angular.

    • Can they be hosted together? How?
    • Can they be hosted separate? How?

    Thanks

  • User Avatar
    0
    alirizaadiyahsi created
    • Can they be hosted together? How?

    Yes, follow this steps: <a class="postlink" href="https://aspnetzero.com/Documents/Merge-Angular-Client-Server">https://aspnetzero.com/Documents/Merge- ... ent-Server</a> Or download automatically merged project, publish and deploy like that is explained in document.

    • Can they be hosted separate? How?

    Yes, for AngularUI check this: <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Angular#deployment">https://aspnetzero.com/Documents/Develo ... deployment</a> for Host project check this: <a class="postlink" href="https://docs.microsoft.com/en-us/aspnet/core/publishing/iis">https://docs.microsoft.com/en-us/aspnet ... ishing/iis</a>

    NOTE: If you deploy them seperately, they behave like two separate websites and they use different domains. So you should change appSettings that is explaining in document.

  • User Avatar
    0
    bilalhaidar created

    Thanks. I will check that and get back to you.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Ok, let us know if you have any problems :)

  • User Avatar
    0
    bilalhaidar created

    Hello, I downloaded the template for .NET 4.6 with ASP.NET Core/Angular 2.

    I am having problems compiling the app and trying it out. I posted about it here: #3513

    So I've read the documentation and I am thinking that I could take the Angular 2 and publish it in a simple HTML website and take the ASP.NET Core (Web.Host) and host it on IIS under a subdomain smth like: api.mydomain.com or a different app on IIS and then let the Angular 2 app make calls to APIs hosted in the subdomain? Is that the story?

    Thanks Bilal

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @drcgreece,

    Yes, this story is correct.

    Just one thing, both angular and host projects can run with or without subdomains.

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Thanks Ismail. So both can run as 2 separate Apps on IIS? How about CORS? Is that catered for?

  • User Avatar
    0
    alper created
    Support Team

    Hi both can run as 2 seperate apps on IIS. You can configure Cors settings

    <a class="postlink" href="https://www.aspnetzero.com/Documents/Development-Guide-Core">https://www.aspnetzero.com/Documents/De ... Guide-Core</a>