Base solution for your next web application
Open Closed

Rookie Deployment Questions #5584


User avatar
0
mdframe created

We are attempting our fist simple deployment to understand the solution and best methods. We created our project as two separate projects in Angular and ASP.NET Core. The documentation we have found seems to prefer a single solution for deployment so our first question is should we have two projects for separation? We felt this was the best solution for our team but could be wrong.

For deployment, we have many options between app.config, appsettings.json, appsettings.staging.json, appsettings.production.json and web.config. Is there documentation or recommendations on each and what the settings perform? I understand some of this is outside of the community however it is challenging us. We get the server side is deployed from the publish process and the Angular is done after compile command however we are not have any success in getting the basic application to work on the hosting provider and we feel its our misinterpretation of deployment details.

Would anyone be able to share your best practices and guidelines for setup and deployment?

Thank you very much!

Matt Frame


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

    Hi,

    First of all, we suggest separate solution if you are working with ASP.NET Core & Angular, you made the right decision :). For deploying ASP.NET Core & Angular project, you can refer to this document <a class="postlink" href="https://aspnetzero.com/Documents/Step-by-step-publish-to-azure-angular">https://aspnetzero.com/Documents/Step-b ... re-angular</a>.

    This document is for Azure deployment but the things you are having trouble with (especially config files) are explained in this document.

    Please let us know if you can't solve your problems using this document.

  • User Avatar
    0
    alper created
    Support Team

    It's better to have 2 separate solutions for Angular and Host especially for large teams. So keep it like that.


    The setting types (appsettings, web.config, app.config) are all Asp.Net's native features. So there's nothing new that Asp.Net Zero adds top of the Asp.Net Framework.

    Web.config: Web.config is needed when you want to host your application on IIS. Web.config is a mandatory config file for IIS to configure how it will behave as a reverse proxy in front of Kestrel. You have to maintain a web.config if you want to host it on IIS.

    AppSetting.json For everything else that does not concern IIS, you use AppSetting.json. AppSetting.json is used for Asp.Net Core hosting. ASP.NET Core uses the "ASPNETCORE_ENVIRONMENT" environment variable to determine the current environment. By default, if you run your application without setting this value, it will automatically default to the Production environment and uses "AppSetting.production.json" file. When you debug via Visual Studio it sets the environment to Development so it uses "AppSetting.json". See this website to understand how to set the hosting environment variable on Windows.

    App.config App.config is another configuration file used by .NET which is mainly used for Windows Forms, Windows Services, Console Apps and WPF applications. When you start your Asp.Net Core hosting via console application app.config is also used.

    So the choice of the configuration file is determined by the hosting environment you choose for the service. If you are using IIS to host your service, use a Web.config file. If you are using any other hosting environment, use an App.config file. Read the Web.Config vs App.config documentation. Also check out Configuration in ASP.NET Core

    TL;DR In Asp.Net Zero no need for App.Config but you will use AppSettings.*.json and if you host on IIS you need Web.Config.