locked
can't use aspnet tables that lives in the same database as the data source RRS feed

  • Question

  • Hi

    I created a simple app (app1) with 1 table and successfully published using desktop and web application type.  When the app was published, it created the database (db_app1) with the table plus all the aspnet table for roles and user.

    tested the app (desktop and web) and added role and new records and were saved succesfully in the database.

    I created a 2nd app (app2), this time I selected 'Attach to external data source' and used the database (db_app1) that was created by app1.  I could attached to the table, created screens. Published the app as desktop and web but couldn't logon using the app admin user in app1.

    Here is the summary when I publish the app by desktop:

    Application Type: Desktop

    Application Server Configuration: Local

    Publish Output: takes the default path. How to publish the default database is set to 'Publish directly to the database now'

    Database connection: points to db_app1 with the same user used in app1. Tested connection OK

    Publish database schema is unchecked. (I did not check this as the schema is still the same)

    Authentication: set to 'No, an application administrator already exists' as there is already an app admin created when app1 was published.

    Prerequisites: set to 'No, only install the prerequisites' | 'Download from the Internet'

    Other connections: same data source as specified in the database connection

    Specify Certificate: blank

    Publish is successful.

    Installed app2 (desktop). Installation successful and prompted for a username and password. Used the app admin username and password created in app1 but can't logon. It displays "Logon information entered is not correct". 

    I then re publish app2, this time in the Database Connection, I checked the 'Publish database schema' and link to the database with Windows authentication.  Tested connection OK.  This is hoping that it may fix the problem. (Before publishing app2, I unsintall app2 from programs)

    Installed app2 again but the result is the same. It will not accept the app admin logon.

    So, I tried to modify the web.config in app2 and change the default connection string of '_IntrinsicData' to point to app1 database where the aspnet tables are located.

       Default:

     <connectionStrings>
        <add name="_IntrinsicData" connectionString="Data Source=|SqlExpressInstanceName|;AttachDbFilename=|ApplicationDatabasePath|;Integrated Security=True;Connect Timeout=30;MultipleActiveResultSets=True" />

    Change it with this:

    <add name="_IntrinsicData" connectionString= "Data Source=MD277427\SQLEXPRESS;Initial Catalog=app1;User ID=app1;Password=xxxxxxx"  />

    Published app2.  Build failed.  It doesn't like the new connection string.  If i put back the original connection string.  the build succeeds.

    How can I use the aspnet tables in db_app1 in app2 application.  Where could I change the settings so that it does not use the default 'IntrinsicData' that the application created.

    Any one who has done this?  Your help is appreciated.


    • Edited by jermacnz Sunday, May 5, 2013 10:37 PM
    Thursday, May 2, 2013 4:32 AM

Answers

  • Hi,

    ASP Forms Authentication tables are considered intrinsic for each LightSwitch application. So in this case you will need to do more work to enable this type of sharing.

    Here's an existing thread with links that hopefully can help you (especially the links that Michael provided).

    Best regards,
    Huy

    • Marked as answer by Angie Xu Tuesday, June 4, 2013 5:06 AM
    Monday, May 6, 2013 6:23 PM