ASP.NET Core 2.0 web application fails with SQLite error when deploying project to Azure web service, but works fine in local environment


Derek Coppinger

It fails when I deploy my ASP.NET Core 2.0 web application to Azure App Service.

This is what is being used in the project.

  • ASP.NET Core 2.0 MVC web application
  • Visual Studio 2017 Enterprise Edition
  • SQLite database
  • Code First Entity Framework
  • Azure App Service

When I run the web application locally in Visual Studio it works fine. The problem occurs when I publish it to an Azure web service which cannot connect to the database. When navigating to the deployed web application URL, it states the following error:

SqliteException: SQLite error 1: 'No such table: inventory'.

I've tried applying update migrations or add migrations to the database a few times, but when deploying to an Azure server it still results in the table not being found.

This is my SQLite connection defined in the Startup.cs file.

     // Add Inventory DB
        services.AddDbContext<InventoryContext>(options =>
        options.UseSqlite("Data Source=Inventory.db"));

        // Add User DB
        services.AddDbContext<UserContext>(options =>
        options.UseSqlite("Data Source=User.db"));

        // Add Purchase Order DB
        services.AddDbContext<PurchaseOrderContext>(options =>
        options.UseSqlite("Data Source=PurchaseOrder.db"));
Derek Coppinger

Put the SQLite database in the "AppData" folder in the .NET solution directory and point your connection string to this new location.

Related


Error deploying ASP.NET Core application to Azure App Service

Trussam Below is the error, Application startup exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Microsoft.AspNetCore

Error deploying ASP.NET Core application to Azure App Service

Trussam Below is the error, Application startup exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Microsoft.AspNetCore

Error deploying .Net Core 3.0 Web API to Azure App Service

Fabricio Rodriguez I recently upgraded my ASP .Net Core 2.2 Web API to .Net Core 3.0. Now when I publish to Azure App Service from Visual Studio 2019 Community (latest updates installed) I get this message: There was a problem starting PropWorx.API on propworx

Error deploying .Net Core 3.0 Web API to Azure App Service

Fabricio Rodriguez I recently upgraded my ASP .Net Core 2.2 Web API to .Net Core 3.0. Now when I publish to Azure App Service from Visual Studio 2019 Community (latest updates installed) I get this message: There was a problem starting PropWorx.API on propworx

Error deploying .Net Core 3.0 Web API to Azure App Service

Fabricio Rodriguez I recently upgraded my ASP .Net Core 2.2 Web API to .Net Core 3.0. Now when I publish to Azure App Service from Visual Studio 2019 Community (latest updates installed) I get this message: There was a problem starting PropWorx.API on propworx

Error deploying .Net Core 3.0 Web API to Azure App Service

Fabricio Rodriguez I recently upgraded my ASP .Net Core 2.2 Web API to .Net Core 3.0. Now when I publish to Azure App Service from Visual Studio 2019 Community (latest updates installed) I get this message: There was a problem starting PropWorx.API on propworx

Error deploying .Net Core 3.0 Web API to Azure App Service

Fabricio Rodriguez I recently upgraded my ASP .Net Core 2.2 Web API to .Net Core 3.0. Now when I publish to Azure App Service from Visual Studio 2019 Community (latest updates installed) I get this message: There was a problem starting PropWorx.API on propworx

Azure ADB2C signin-oidc fails in ASP.NET Core 2 web application

Matruma Hope someone can help me with my Azure AD B2C and ASP.NET Core 2 web application. The problem is with the signin-oidc routing. When I run it locally, everything works fine, but when I push it to Azure, the page returns a 400 error, see the screenshot b

Azure ADB2C signin-oidc fails in ASP.NET Core 2 web application

Matruma Hope someone can help me with my Azure AD B2C and ASP.NET Core 2 web application. The problem is with the signin-oidc routing. When I run it locally, everything works fine, but when I push it to Azure, the page returns a 400 error, see the screenshot b