Build and Deploy

You created your Radzen application. Congratulations! Now it is time to deploy it on your server.

Build and deploy the Angular application

Install Node.js

In order to build your Radzen application for production you need Node.js v6 or newer. If you don’t have Node.js installed on your machine you can get it from the official web site or via nvm (Node Version Manager).

Build your app for production

Before you deploying your application you need to create a production build.

  1. Open a terminal window and go to the directory of your Radzen application. That directory was specified when you created your app.
  2. Change the current directory to client. Radzen outputs the Angular application in a client sub directory.
  3. Run npm install. This will install all dependencies required to build and run your Radzen application. Relax. It will take a while.
  4. When the dependencies install you can build your application with Angular CLI.
    • Windows: run .\node_modules\.bin\ng build --prod
    • macOS or Linux: run ./node_modules/.bin/ng build --prod

If you won’t deploy your app at root level you need to specify the path via the --base-href option. For example if you plan to deploy your app to http://example.com/foo/bar/ you must run ng build --prod --base-href /foo/bar/.

Change production endpoints

Sometimes you would like to use a different REST/OData service URL in production. To do so update src/environments/environment.prod.ts - replace the URL of your services with the new ones.

Deploy

After the build finishes the output will be available in the dist directory of the app. Deployment is as simple as copying the dist directory to your server.

You can also test the production build by running ng serve --prod and then opening http://localhost:4200 in your browser.

Build and deploy the ASP.NET Core application

Radzen creates a ASP.NET Core application if you use a MS SQL Server data source. Here is how to deploy it.

Deploy to IIS

  1. Follow the official Publishing to IIS instructions to prepare IIS for ASP.NET Core support.
  2. Build the ASP.NET Core application.
    1. Open a terminal window and go to the directory of your Radzen application.
    2. Change the current directory to server.
    3. Run dotnet publish -c Release to package the application in Release mode.
    4. Copy the contents of the server\bin\Release\netcoreapp1.1\publish directory to your server.
  3. Add a web site or an application from the IIS Manager pointing to the location from the previous step.

Now we need to specify the connection string to your production MS SQL Server. We will do this by defining an environment variable with the Radzen application will read at runtime.

  1. Open IIS Manager.
  2. Select the Radzen web site/application created in the previous step and click Configuration Editor. Configuration Editor
  3. Open the Section dropdown and select system.webServer/aspNetCore. Section
  4. Open the From dropdown and select ApplicationHost.config. From
  5. Click the button next to environmentVariables.
  6. Add a new environment variable with name ConnectionStrings:<DataSourceName>Connection where DataSourceName is the name of your MS SQL data source as defined in Radzen e.g. ConnectionStrings:NorthwindConnection. Set the value to the actual connection string to your production MS SQL Server. Connection String
  7. Close the environment variable editor and click the Apply button in the top right corner of the Configuration Editor.

If you hit a bug or want to get in touch please open an issue or send an email to info at radzen.com.

Make sure you are running the latest version: 1.6.0.