locked
Windows Authentication issue RRS feed

  • Question

  • I am creating an app with Windows Authentication (allow any authenticated Windows user) and when I publish the app and try to deploy it to another machine, I get a 'an error occured while communicating with the database' error. I put my username in as the Application Administrator in the Authentication section of the publishing wizard. Is that not the way to set the Application Administrator? 

    Any help would be appreciated. 

     

    Thursday, November 17, 2011 9:21 PM

Answers

  • The "Application Administrator" is a different user than the credentials used to log into the database.

    The connection to the database requires you use credentials that the database server allows.  In the "Database Connections" tab, you are given an option to give 2 separate database connection strings.  The first is used to create the database and create all the tables in it.  The second is what the application uses while running (when it doesn't need to modify the shape of the database anymore, which requires less priviledges).  Check which account you are using in the "Database Connections" tab and make sure that the account used in the first connection string has access to the database server.

    In the "Authentication" tab, you are able to specify which user should have Administration priviledges for your application.  This is the user that will log in the first time after you deployed and start adding other users to the application so other people can start using it.

    Friday, November 18, 2011 5:09 PM
    Moderator

All replies

  • Is this using the intrinsic (LightSwitch) database, or are you attaching to an external dtaabase?

    Yann - LightSwitch Central

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Friday, November 18, 2011 11:19 AM
    Moderator
  • This is using a SQL Server 2008 database.
    Friday, November 18, 2011 12:42 PM
  • The "Application Administrator" is a different user than the credentials used to log into the database.

    The connection to the database requires you use credentials that the database server allows.  In the "Database Connections" tab, you are given an option to give 2 separate database connection strings.  The first is used to create the database and create all the tables in it.  The second is what the application uses while running (when it doesn't need to modify the shape of the database anymore, which requires less priviledges).  Check which account you are using in the "Database Connections" tab and make sure that the account used in the first connection string has access to the database server.

    In the "Authentication" tab, you are able to specify which user should have Administration priviledges for your application.  This is the user that will log in the first time after you deployed and start adding other users to the application so other people can start using it.

    Friday, November 18, 2011 5:09 PM
    Moderator
  • The connection to the SQL database is through Windows Authentication and I gave the public database role in SQL server write, read, and insert permissions, so I should be ok for the database connection login by using my domain name. 

     

    I created myself as a user in Lightswitch and gave myself the SecurityAdministration permission and entered my name as the Application Administrator. 

     

    I still can't get the app to work with  any type of authentication.

    Friday, November 18, 2011 7:21 PM
  • Are you having this problem as you're publishing the application? Or after the application has been successfully published.

    When you say that "I created myself as a user in Lightswitch and gave myself the SecurityAdministration permission", what you do before you publish has NO bearing on what happens AFTER you publish, nothing gets "transferred". Only the information that you enter in the wizard counts.

    The username that you enter in the wizard is given SecurityAdmin permission in the published application, & is the only user than can access the permissions/roles screen in it.

    Actually my guess is that you're getting this error (which I just read closer) when trying to publish the application. I've had this error when trying to publish to a SQL Server that was in a different domain than my machine was joined to.


    Yann - LightSwitch Central
     
    If you found my post helpful, please click "Vote as Helpful"
    If I answered your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
     
    Click here for FREE Themes, Controls, Types and Commands
    Monday, November 21, 2011 12:06 AM
    Moderator