locked
Web deploy using MS deploy package wiped out existing database RRS feed

  • Question

  • I deployed my application as a 3 tier using the MS deploy package method.

    Under the "Publish Output" tab I selected "Create a package on disk" and when the publish finished I copied the zipped package to the IIS server, right clicked on the Default Website and selected "Import package". Filled in all the required fields and the package was deployed.

    The application executed fine and everything appeared to be ok until I noticed that all the tables were gone. The package deploy had wiped out every table in the database and left me with a blank database comprised of no tables. Why in god’s name would a package install do that? Not as much as a warning that you were about to delete every table in the database... nothing!!! Just blithely wipe out an entire database without as much as a mention that this might reset you database.

    I have a backup but that's not the point. Why no warning anyplace? Not in the procedure, not in the read me's, and not in the actual execution of the deploy process.

    This just isn't right.  Beware of the "Package Deploy".

     

    Thursday, February 21, 2013 1:48 AM

Answers

  • I stumbled upon what actually happened but I can't explain why it happened.

    The database was not wiped out... it was there and fully intact. The problem was that my login in SQL somehow had been corrupted which resulted in the removal of my access rights to the SQL database.

    If I used SQL Server Management Studio I could see that the database existed but I could not see any tables in the database which is what lead me to believe that the database was reset. I am administrator of the SQL server so I didn't even consider a permissions problem until one of the other admins logged in and had no trouble seeing the tables.

    I then changed the "Connection String" under ASP.Net in IIS manager to use different login credentials to SQL and everything started working as expected. I cannot explain why using a deploy package rather than a direct publish should have made any difference. It may simply have been a coincidence.

    • Proposed as answer by ADefwebserver Sunday, February 24, 2013 5:12 PM
    • Marked as answer by Jyuma1 Monday, February 25, 2013 12:12 AM
    Sunday, February 24, 2013 5:03 PM
  • during publishing (!=deployment) you can specify that visual studio should create a "dif" against the existing database. That diff will only the necessary changes and will no wipe out your db.

    paul van bladel

    • Marked as answer by Jyuma1 Thursday, February 21, 2013 1:56 PM
    Thursday, February 21, 2013 1:40 PM

All replies

  • Ed,

    I don't use packages myself, but that just doesn't sound "right". LightSwitch normally goes out of its way to warn users of ANY data loss. And I can't see why that wouldn't be the case in a script or package.

    It sounds like the package import might not have been entirely successful, but then it should have been wrapped in a transaction, so if there's an error it all gets rolled back.

    I'm going to have to leave this one to the people who use packages, but as I said, it doesn't sound right to me.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, February 21, 2013 6:00 AM
    Moderator
  •  Working on my development system (my home office) I used VS2012 and LSV2 to create a zipped deploy package that I then transferred to the clients SQL server via Remote Web Workspace (a built-in function of Microsoft Small Business Server). Then I opened IIS (via remote connection) and used the deploy function built into IIS 7.0 to "import" the package. The deploy ran fine and the website was created but after the deploy completed the existing tables in SQL were gone. I agree that something doesn't sound right but I can't fathom why a deploy in this manner would wipe out the tables in a SQL database when the deploy using the direct method does not demonstrate the same behavior.

    I must have done something wrong but I until I understand exactly what I did wrong I won't be using the deploy package method again.

    Thursday, February 21, 2013 10:12 AM
  • during publishing (!=deployment) you can specify that visual studio should create a "dif" against the existing database. That diff will only the necessary changes and will no wipe out your db.

    paul van bladel

    • Marked as answer by Jyuma1 Thursday, February 21, 2013 1:56 PM
    Thursday, February 21, 2013 1:40 PM
  • Thank you.
    Thursday, February 21, 2013 1:56 PM
  • You are welcome.

    to be honest,

    • creating a package on disk,
    • first publishing to staging environment
    • testing
    • deployment to production

    is the most save deployment experience.

    You can find on my blog (blog.pragmaswitch.com) several LightSwitch / WebDeploy related articles. also about the deployment of the surrounding website, app pool, certificates, etc. ..


    paul van bladel

    Thursday, February 21, 2013 2:26 PM
  • I stumbled upon what actually happened but I can't explain why it happened.

    The database was not wiped out... it was there and fully intact. The problem was that my login in SQL somehow had been corrupted which resulted in the removal of my access rights to the SQL database.

    If I used SQL Server Management Studio I could see that the database existed but I could not see any tables in the database which is what lead me to believe that the database was reset. I am administrator of the SQL server so I didn't even consider a permissions problem until one of the other admins logged in and had no trouble seeing the tables.

    I then changed the "Connection String" under ASP.Net in IIS manager to use different login credentials to SQL and everything started working as expected. I cannot explain why using a deploy package rather than a direct publish should have made any difference. It may simply have been a coincidence.

    • Proposed as answer by ADefwebserver Sunday, February 24, 2013 5:12 PM
    • Marked as answer by Jyuma1 Monday, February 25, 2013 12:12 AM
    Sunday, February 24, 2013 5:03 PM
  • Jyumal1 - Please mark your last post as the answer because it will help others who run into the same problem :)

    The Visual Studio LightSwitch Marketplace

    http://LightSwitchHelpWebsite.com

    Sunday, February 24, 2013 5:13 PM