-1

I have realized that after I deploy my project to Azure. The connection string of global.asax is not function and cause that the page that I use sql command for feature purpose were gone and cannot function. How can I fix it? Can the experiencer give the solution how to fix this problem? Thank you very much.

    //connection String
    public const string CS = @"
    Data Source=(LocalDB)\mssqllocaldb;AttachDbFilename=|DataDirectory|\MTCompanyDB.mdf
    ;Integrated Security=True";
ZT Chuah
  • 9
  • 6

1 Answers1

1

LocalDb doesn't exist for Azure. LocalDb is a feature of SQL Server Express, there is no equivalency of that on the service (machine) you are deploying your App Service website on.

You could set the connectionstring in web.config and when you deploy to azure Create a SQL Database.

enter image description here

After publish, click Configure to open the publish settings. enter image description here

Click Use this connection string at runtime(update destination web.config) which will use the Azure sql connectionstring when your webapp deploy to azure. enter image description here

For more details, you could refer to this article.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30