Error publishing Lightswitch database to new SQL Azure Database preview tiers RRS feed

  • Question

  • Using Visual Studio 2013 update 3, Lightswitch fails to publish to a brand new Azure 'Basic' database, with the following error:

    Error    1    An exception occurred when deploying the database for the application.
    An error occurred during deployment plan generation. Deployment cannot continue.    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v4.0\Publish\v2.3\Microsoft.LightSwitch.Publish.targets    1563    10

    Turning on build trace logging reveals no more information than the error above. I have tried with both a database project attached to the Lightswitch project and without the database project. Publishing to the Azure 'Web' database tier works as expected.

    Has anyone been able to get a Lightswitch app to publish to the new tiers? Is there a specific change required to allow publishing to the Azure preview database tiers?

    Tuesday, August 12, 2014 10:36 PM

All replies

  • Hi Joel,

    Welcome to Lightswitch forum.

    According to your description above, the error message occurs after deploy Lightswitch app to Azure premium database tier, and this issue is related to your database.

    For this issue, it's recommended to follow the deployment procedure, and check whether you configure it properly.

    Easily Deploy Your LightSwitch Apps to Azure Websites

    Please let me know if there is anything that I can do to help.                     

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 19, 2014 9:37 AM
  • Hi Angie

    I have followed that guide exactly, however the problem persists when publishing to the new Azure preview tiers.

    If I publish to the Azure SQL Web and Business tiers it works, however if I publish to the new Basic tier it fails with that error in the original question.

    I'm still not sure how to proceed, as we're looking to migrate away from the Web and Business tiers for our Lightswitch application, as those tiers are becoming redundant.



    Wednesday, August 27, 2014 11:03 PM
  • Hi Joel,

    Thanks for your feedback.

    According to your description, I'd like to suggest you to use SQL Azure database, not local database, and check whether it can fix it.

    Please let me know if there is anything that I can do to help.

    Best regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, August 28, 2014 9:37 AM
  • I will try this out and see if I can tell what's up.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Thursday, August 28, 2014 7:14 PM
  • I just changed my database to one of the new database tiers (Standard) and am getting the same error.

    Can we get an official response from MS as this is going to get critical for a few people.

    Tuesday, September 16, 2014 7:56 PM
  • We are investigating the issue.  I was able to publish to a "Standard" database yesterday ("Basic" failed but when I scaled it to "Standard" it worked).  Will update the thread when I find out more.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Tuesday, September 16, 2014 8:29 PM
  • I am also having this problem.  I updated the database from "Web" to "Basic" as it said that option was redundant and 12 hours databases, two frustrated clients, I am still getting the publishing error.

    I'll switch to standard and start over.....and report back.

    Wednesday, September 17, 2014 3:20 AM
  • Yep standard works.....basic doesn't.
    Wednesday, September 17, 2014 3:39 AM
  • ..and I can confirm Web works
    Wednesday, September 17, 2014 5:26 AM
  • Hi Dave,

    I too faced problems with the new tiers.  I was making some major updates to my schema as I was transitioning from my LS v1 to LS v4, and even S2 tier was not enough and it would complain.. I switched back to Web tier and it works. Reading around, I believe it is because of the slow response and my VS2013 timed out during the publish. Even if I ran the SQL update script manually, it would take forever and did not bothered to see it through.

    Also, I noticed that the Basic and Standard tiers disabled the create database as a copy command. How then are we expected to quickly make a copy of the database?

    Considering the price hike of ~6x from Web tier to Standard S2, the SQL Azure service is worst off in terms of performance.

    Best regards,


    • Edited by cte00 Wednesday, September 17, 2014 7:28 AM
    Wednesday, September 17, 2014 7:25 AM
  • Well, I have news, but it's not really what I wanted to hear.

    According to the SQL Azure team, 'Basic' is altogether too slow to support an import operation.  They said that


    "import operations will complete faster with S2 and higher service tiers and you can downgrade to a lower performance level right after import."

    They also said that since pricing is now hourly, a short-term scale-up wouldn't increase your bill that much.  I am going to talk to some more people to see if I can get more info as this seems sub-optimal.

    @cte00, were you ever able to successfully publish when you scaled to "S2"?  I was able to publish with an S0, but my data model was extremely small.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Wednesday, September 17, 2014 1:50 PM
  • I was going to publish this in a new thread, but I think this it is appropriate here.  I am very concerned about the performance/priding of the new Azure SQL database tiers.  For current applications using the Web/Business databases (which will be retired September 2015 I believe), you will probably need to move to the Premium 1 or even Premium 2 tier to get similar performance.

    This post has detailed benchmark info: SQL Azure benchmarks

    There are three new tiers: Basic, Standard and Premium.  Within these tiers there are addition levels.  The problem is that for LightSwitch, it appears that Basic is useless, Standard might work for the smallest databases/loads and Premium will probably be required for similar to better performance.  OK, that's fine except for the pricing.  Here are the current prices:

    Premium Level 1: $465/Month

    Premium Level 2: $930/Month

    Premium Level 3: $3,270/Month

    Full pricing info can be found here: SQL Azure pricing

    This is an incredibly huge price increase and I am definitely considering moving to a different cloud host, which I really don't want to do.

    Also, the new scheme is particularly problematic if you need multiple smaller databases with good performance.

    Please correct me if I have misstated anything.



    Wednesday, September 17, 2014 5:07 PM
  • Thanks for posting that link for the benchmarks.  The SQL Azure team members I contacted stood behind this statement:

    Standard: The go-to option for most cloud applications, supporting multiple concurrent queries. Examples include workgroup or web applications.


    I will send them the benchmark link and see if they have a response.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Wednesday, September 17, 2014 5:39 PM
  • Dave, can I point out that while my Customers use a Standard or better for their production systems, I use a lesser tier for development and staging.

    During development/staging I do not have a lot of data or high volumes of transactions so I have no need for anything bigger than Basic.

    Switching to a standard tier to make schema update during development is NOT efficient, nor do I want to pay for capacity I do not need.

    Thanks for your help.

    Wednesday, September 17, 2014 5:46 PM
  • Hi Dave

    I'm in the same boat after switching to the Basic subscription.

    However, I notice that because I didn't actually change my database schema, the below error hasn't impacted my published app changes.

    But before I switch my solution from Staging to Production, I need to be 100% sure that my understanding that the failed schema doesn't impact the publishing in cases where no schema changes were made is correct.

    Please confirm if you can. Thanks.

    5> Publish Succeeded.
    5>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v4.0\Publish\v2.2\Microsoft.LightSwitch.Publish.targets(1563,9): error : An exception occurred when deploying the database for the application.
    5>An error occurred during deployment plan generation. Deployment cannot continue.
    5>Done building project "SkeMaz.lsxproj" -- FAILED.
    5>Build FAILED.
    ========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========



    Wednesday, September 9, 2015 4:11 AM
  • Hi

    I tried to follow all the advice given and below is a screen-shot saying I'm on a standard plan but I still cannot publish with the same problem.

    Any help will be greatly appreciated. Thanks.


    Friday, October 9, 2015 12:32 PM
  • Hi Dave

    When I was forced to upgrade, I moved to S1 Standard but since then I've not been able to publish. I see the below message.

    3>        Updating appPoolPipeline (skemaz__staging).
    3>        Publish Succeeded.
    3>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v4.0\Publish\v2.2\Microsoft.LightSwitch.Publish.targets(1563,9): error : An exception occurred when deploying the database for the application.
    3>An error occurred during deployment plan generation. Deployment cannot continue.
    3>Done building project "SkeMaz.lsxproj" -- FAILED.
    3>Build FAILED.
    ========== Build: 2 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========
    ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

    I am now in a position where I need to publish a new version of my app with schema changes.

    The code changes publish Ok but not the schema. I know this because on publishing to my Staging site it crashed when I run the Web App in Staging because the code doesn't match the old schema. The Production site with the old code is still working but I need to update some bug fixes.

    Please advise. Thanks, Mark.


    Tuesday, October 13, 2015 2:39 AM
  • Hi

    I've tried all the suggestions to no avail. This is now getting pretty desperate now because I cannot update my production app with my Schema changes.

    See below, I upgraded to Standard S2:

    When I publish it gets to this point and doesn't seem to progress.

    After about 10 mins I get the below failure message:

    Any help will be appreciated. Thanks in advance, Mark.


    Thursday, October 15, 2015 4:42 AM
  • Hey Mark,

    I feel your pain !!!

    My suggestion is that you:

    1. Copy your database. Make sure that Copied DB is scaled correctly for publishing from LS.

    2. Create a new website

    3. Publish to the new website and use the copied database. 

    You seem to be using deployment slots which will NOT work with Lightswitch as they use a common database and schema for both slots!!!! Slots are a bad idea for any site that is dependent on a schema ... good idea but you notice that MS does not push it anymore.

    You will have to create a separate staging website and database IMHO.

    Can I also suggest that you turn on Diagnostic verbosity to get some idea as to where the problem is occurring.

    • Edited by Ian E Thursday, October 15, 2015 5:26 AM Changed exported to copied
    Thursday, October 15, 2015 5:17 AM
  • Hi Dave

    Please assist if a all possible. This is driving me nuts and is starting to cause problems with my customers.

    If you look at my screen-shots in reply to skolleCloud Quarter below, I upgraded to S2 but still get the error. So the work-around doesn't seem to work for me.

    Any assistance will be greatly appreciated.

    Thanks in advance, Mark.


    Wednesday, October 21, 2015 1:18 AM
  • Hi Ian

    Many thanks for assisting. Now I'm really terrified! The system has been live for 18 months and I followed all the advice from Beth Massi (the then MS LS Product Evangelist) and others on publishing my LightSwitch solution to the letter and there was no mention of using deployment slots - in fact I'm pretty much clueless on what they actually are (typical LS developer - I can code in C# and JS but my DBA skills are lacking).

    Quite frankly I'm petrified to act on your advice to backup and creating a new web site 'cause I'll probably really mess things up and lose customers in the process.

    I'll definitely turn on Diagnostic verbosity to get more information.

    If you can think of any easier paths to a solution I'd be extremely grateful.

    Thanks for assisting and best regards, Mark.


    Thursday, October 22, 2015 6:38 AM
  • Hey Mark,

    I do this multiple times daily and I can tell you that there is really nothing to worry about.  I also change from basic -> standard -> basic all the time when testing.

    Quite frankly you should have a backup of everything. My rule of thumb is to ALWAYS make a backup before making any major change to a web application or it's associated database.

    Note: My instructions are using the old azure portal.

    The best way to make a backup is go to the website and select linked resources. Click link a resource and select your database. Now you can go to backups and perform a backup. Note you require standard tiers for the database and website + you need  a storage account.

    What backup does is create a zip file containing contents of the website and the database. You can also use the contents of the zip file to move the Azure website + database to a local IIS + SQL Server installation by copying the wwwroot folder and importing the dacpac contained in the zip file. 

    The is the important part of doing the backup is you have a snapshot of both the database and corresponding web application that work together. i.e. The schema matches the app!!!If something goes wrong, you can restore both and you are pretty much guaranteed to be operational again.

    At some later point in time, you can restore the backup and the restore wizard will ask for a new website name and database name (if necessary). Remember, after a restore you will have to go into the web config and point to the new database.

    To copy the database, select your database and press Copy. it will ask for the name of the new database. I do this all the time when I create a new staging site to test with production data.

    My workflow for testing with my customers is:

    1. Create a new staging website (I don't use slots as they don't work with Lightswitch).
    2. Copy the production database to a new staging database.
    3. Publish my LS app to the staging website + database.
    4. Test until signed off.
    5. Delete both the staging website and database.

    Are you able to publish to Azure at all? What version of Azure SQL Server is the database running on? Is it V2 or V12?

    There is an issue with the latest SSDT package not being able to publish to V12 servers/databases.


    • Edited by Ian E Thursday, October 22, 2015 7:30 AM
    • Proposed as answer by ITPSB Friday, November 13, 2015 9:08 AM
    Thursday, October 22, 2015 7:21 AM
  • Hi Ian

    Many thanks again. I currently use Cloud Cellar for backups and back up my solution regularly but I'll definitely use your method. Thanks for the advice.

    I'm going to follow your instructions in the morning (and hopefully alert) and update the post with the outcome.

    Many, many thanks indeed. There's no way I would have figured this out.

    Cheers, Mark.


    Thursday, October 22, 2015 7:49 AM
  • Hi Ian

    Again, thanks for your assistance - there's no way I could have figured this out by myself.

    I'm at the point where I need to "Create a new staging website (I don't use slots as they don't work with Lightswitch)".

    Searching on how to do this I find this article:

    It starts by suggesting the following"

    "When you deploy your web app to App Service, you can deploy to a separate deployment slot instead of the default production slot when running in the Standard or Premium App Service plan mode."

    However, you recommend not to use slots.

    Please point me to where I can learn how to do this.

    Thanks again, Mark.


    Saturday, October 31, 2015 7:47 AM
  • Hi Ian

    I still don't know how to "Create a new staging website (I don't use slots as they don't work with Lightswitch)" I only see documentation that starts off saying I need to create a slot.

    Anyway, even though I still get the below error, my schema is indeed updated and the solution appears to have published and works!

    I'm going to muddle along and will have to give you creadit for providing an answer (even though I still get the error and don't know how to create a staging site without using slots).

    Many thanks, Mark.

    4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v4.0\Publish\v2.2\Microsoft.LightSwitch.Publish.targets(1563,9): error : An exception occurred when deploying the database for the application.
    4>An error occurred during deployment plan generation. Deployment cannot continue.
    4>Done building project "SkeMaz.lsxproj" -- FAILED.


    Friday, November 13, 2015 9:08 AM
  • Hi Mark,

    I have already explained how to create a Staging site:

    1. Copy existing database. i.e. From MyDatabase to MyDatabaseStaging.
    2. Create a new Website. i.e. MyWebSiteStaging.
    3. Publish to  the new website and database. i.e. Website = MyWebSiteStaging and the database will = MyDatabaseStaging.

    Your issue seems to me that you need to learn how to use the Azure web admin tools to perform these basic functions. They are extremely easy to use in either portal. I recommend getting a "Playground" 30 day subscription and playing around in it before trying this in your customers subscription.

    Good Luck,


    Friday, November 13, 2015 6:13 PM
  • Hi Ian

    Many thanks. I guess I was a bit spoiled with the way it used to work.

    Seemed a lot simpler then.

    Best regards, Mark.


    Saturday, November 14, 2015 7:41 AM