ASP.NET azure hosted app / sql server Works on localhost only

Anel Hodžić 0 Reputation points

When I run my simple CRUD app on localhost it works really good.

Hint: It is using SQL server to insert data and server is hosted on my Azure Subscription inside same Resource Group

Deployed app :

Not working route : School - Region - Countries


On Azure SQL Server - Networking this is my props

User's image


  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "AZURE_SQL_CONNECTIONSTRING": ",1433;Initial Catalog=myDB;Persist Security Info=False;User ID=myUser;Password=myPW;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=120;"


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Models;

namespace Controllers
    public class CountriesController : Controller
        private readonly ApplicationDbContext _context;

        public CountriesController(ApplicationDbContext context)
            _context = context;

        // GET: Products
        public async Task
A set of technologies in the .NET Framework for building web applications and XML web services.
4,358 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
3,404 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
838 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anel Hodžić 0 Reputation points

    Detailed log was found at this path :

    User's image

    Keep in mind that your appsettings.json file was not deployed

    You need to add SqlConnection string in your app with prefix as explained : Configure Connection Strings