SQL express not working

Ted Toso 1 Reputation point
2020-08-13T19:53:18.303+00:00

my web app runs fine locally but not when deployed. it can not connect to the sql express db

my connection string

Data Source=.\SQLEXPRESS;;AttachDbFilename=|DataDirectory|TriplidataDatabase.mdf;Integrated Security=True;Connect Timeout=30

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,914 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 26,721 Reputation points Microsoft Employee
    2020-08-14T16:34:09.387+00:00

    Adding further, kindly let us know the following details:

    What is the exact error message you receive?
    Have you provisioned a Linux or Windows WebApp?
    Just to clarify, is your database provisioned on an Azure VM or on-prem?

    Just highlighting, in general scenarios, the following settings helps.

    1. Adding App Service’s IP Address (allow list /whitelist)) on on-premises database firewall for the network communication to flow through.
    2. Adding on-premises database IP Address (allow list) on App Service through Azure Portal.

    Please share the requested information, we would be more than happy to assist you further.

    0 comments No comments

  2. Ryan Hill 28,631 Reputation points Microsoft Employee
    2020-08-14T17:23:47.143+00:00

    @Ted Toso SQLEXPRESS is a trimmed down database engine included with Visual Studio, used for development purposes. The App Service platform doesn't contain that software. You do have several options though.

    1. If you're testing your app in the cloud and not worried about persistence, you can use an InMemory data set.
    2. You can use SQLite, like SQLExpress in that it's lightweight but doesn't have all the features of SQL.
    3. Use an SQL Azure with your application. You can follow this tutorial.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.