Attach data source stuck at "Retrieving database objects" RRS feed

  • Question

  • I have been developing and updating a LightSwitch application for a little over a month. The datasource comes from a MS SQL Server. The following points below may help debug the problem:

    • I deployed an empty database of the current schema and updated/attached the data source successfully.
    • Backing up and redeploying the database/datasource that is hanging will still cause attachment/update to hang
    • I have successfully create an EF6.x model of the said data source

    Because there is no error message, I am completely lost as to what the problem is. I ran into this problem during the development but solved it by deleting the hanging database and redeploying an empty database based on the schema. I was hoping this problem would not recur.

    I hope someone has a solution here.

    Monday, December 15, 2014 2:51 PM

All replies

  • Hi Lynart,

    From your description above, first you need check whether connect to SQL Server database properly, see: Connect to SQL Server Database.

    Secondly, if you deploy your Lightswitch application to IIS, you can use the method below to diagnose this issue. See:

    Diagnosing Problems in a Deployed 3-Tier LightSwitch 

    If you have any concern, please let me know.

    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.

    • Marked as answer by Angie Xu Thursday, December 25, 2014 8:16 AM
    • Unmarked as answer by Lynart Tuesday, December 22, 2015 4:08 PM
    Wednesday, December 17, 2014 9:26 AM
  • On the database which is being used, add a “plan guide”. Copy the query into the guide from SQL profiler, choose scope type SQL, and under Hints put OPTIONS(HASH JOIN).

    Friday, October 30, 2015 1:32 PM
  • I realise this is a little old but I'm having the same issue. The database I use as my data source has grown considerably since the LightSwitch app was originally written and now the query to get the db objects just takes forever. Judging by the amount of data I got back after 15 minutes, it could take 4 hours to complete !

    I copied the query into SSMS and got the same poor response, I then added a query plan as suggested by winsloses. Re-ran the query in SSMS and the results came back in 1 second.

    However, Visual Studio 2015 still takes the same amount of time (i.e. longer than I can possibly wait!). I shut down VS and restarted and again grabbed the query from SSMS Activity monitor in case a different query had been generated but I get the same results. The query runs in 1 second from SSMS but takes forever from VS2015.

    Any other suggestions will be greatly appreciated.

    Tuesday, March 7, 2017 4:59 PM