How to: Deploy a 3-tier Application

The process of deploying a 3-tier LightSwitch-based application differs depending on the application type and deployment topology that you select.

3-tier applications can be hosted on a server that is running Internet Information Services (IIS) or on Windows Azure. For more information about deploying to Windows Azure, see How to: Host an Application on Windows Azure

  • Desktop client, 3-tier deployment creates an application that runs on the end-user’s Windows desktop; the database and server components run on a server that runs IIS or on Windows Azure.

  • Web client, 3-tier deployment creates an application that runs in the end-user’s web browser; the database and server components run on a server that runs IIS or on Windows Azure.

There are two ways to deploy a 3-tier LightSwitch-based application, by either publishing or packaging it. In either case, the LightSwitch Publish Application Wizard guides you through the deployment process.

  • A published application can be run on client computers immediately after the wizard has been completed. The application is ready to install and the installation automatically deploys the database schema to SQL Server. You must have administrative access to both the Web server and the database server for this option. The server must also be provisioned for LightSwitch. For more information, see How to: Configure a Server to Host LightSwitch-Based Applications

  • A packaged application means that everything that is required to run the application is bundled together. Additional steps must be taken by the server administrator to install the application and make it available to end users. For more information, see How to: Install a LightSwitch Application on a Server.

To publish a 3-tier application

  1. On the menu bar, choose Build, Publish <Application Name>.

    The LightSwitch Publish Application Wizard appears.

  2. On the Application Type page, choose either the Desktop or Web option button, and then choose the Next button.

  3. On the Application Server Configuration page, choose the IIS Server option button. If you are not sure whether the server that’s running IIS has the necessary prerequisites installed, clear the IIS Server has the LightSwitch Server Prerequisites installed check box, and then click the Next button; otherwise, leave the check box selected, and then choose the Next button.

    Note

    If you have a publish settings file (.publishsettings or .pubxml) that was created for another application, you can use that file to provide the rest of the information that you need for deployment. Choose the Import Settings button to specify a publish settings file.

  4. On the Publish Output page, choose the Remotely publish to a server now option button.

    The Details section appears.

  5. In the Service URL field, enter the Uniform Resource Locater (URL) for the server that is running IIS.

  6. In the Site/Application field, enter a path for the web page that is used to host the application manifest. This is typically Default Web Site/ApplicationName, where ApplicationName is the name of your application.

  7. In the User Name and Password fields, enter your IIS credentials.

  8. If you are deploying for testing purposes, select the Allow untrusted certificate check box. If you are deploying for production, leave the Allow untrusted certificate check box cleared, and then choose the Next button.

  9. On the Security Settings page, choose On to require a secure HTTPS connection, or choose Off if your application doesn’t need a secure connection, and then choose the Next button.

    For more information about security, see Security Considerations for LightSwitch.

  10. On the Database Connections page of the wizard, enter the administrator and user connection strings for the database server where you want to publish the application database, and then choose the Next button.

    Note

    When you publish updates, you don't need to republish the database unless you have changed the schema. To prevent the database from being republished, clear the Publish database schema check box.

    The database server must be pre-configured to have SQL Server 2005 or a later version, or SQL Server 2005 Express or a later version. It does not have to be located on the same server where you are publishing the application.

    Note

    The user connection string cannot use Integrated Security; you must specify a valid user name and password for the connection.

  11. If you have enabled authentication for your application, the Authentication page will appear. Enter a valid User Name, Full Name, and Password for the user who will be the initial application administrator, and then choose the Next button.

    Note

    When you publish updates, the application administrator already exists. Select the No, an Application Administrator already exists check box to skip this step.

  12. On the Other Connections page, update the connection strings for any additional connections as needed and then choose the Next button.

  13. On the Specify a Certificate page, select the Specify a Certificate check box, and then choose one of the three options for adding a certificate (.pfx) file. To publish without a certificate, leave the Sign the Xap File check box cleared.

    Note

    Publishing your application without a certificate will cause a security warning to be displayed when an end user runs the application, and in some cases may prevent the application from running. In addition, by signing your application, your users know that your application originated from a trustworthy source. For more information, see Signing a XAP File By Using a Certificate.

    To add a certificate from your local store

    1. On the Specify a Certificate page, choose the Select a certificate from this computer’s store button.

      The Windows Security dialog box appears.

    2. In the Windows Security dialog box, choose the certificate that you want to use, and then choose the OK button.

      Basic information about the certificate appears. You can choose the More Details button to display more information about the certificate.

    To add an existing certificate from another location

    1. On the Specify a Certificate page, choose the Browse for a certificate button.

      The Select File dialog box appears.

    2. In the Select File dialog box, browse to the location of the certificate that you want to use, and then choose the OK button.

      Basic information about the certificate appears. You can choose the More Details button to display more information about the certificate.

    To create a test certificate

    1. On the Specify a Certificate page, choose the Create a Test Certificate button.

      A password dialog box appears.

    2. Enter and confirm a password for the new certificate, and then choose the OK button.

      Basic information about the certificate appears. You can choose the More Details button to display more information about the certificate.

  14. Choose the Publish button to publish the application.

    When the application is published, users can install it from the website specified by the Site/Application name. For a desktop application, the user will be prompted to choose the Install <ApplicationName> link, where ApplicationName is the display name of your application. The application will be installed on the end-user's computer and will be available on the Start menu. For a web application, the application will open in the browser when they navigate to the URL.

    Note

    If you have enabled authentication for your application, the application administrator will have to authorize users before they can run the application. For more information, see LightSwitch Authentication and Authorization.

To package a 3-tier application

  1. On the menu bar, choose Build, Publish <Application Name>.

    The LightSwitch Publish Application Wizard appears.

  2. On the Application Type page, choose either the Desktop or Web option button, and then choose the Next button.

  3. On the Application Server Configuration page, choose the IIS Server option button. If you aren’t sure whether the server that’s running IIS has the necessary prerequisites installed, clear the IIS Server has the LightSwitch Server Prerequisites installed check box, and then choose the Next button. Otherwise, leave it selected, and then choose the Next button.

    Note

    If you have a publish settings file (.publishsettings or .pubxml) that was created for another application, you can use that file to provide the rest of the information that you need for deployment. Choose the Import Settings button to specify a publish settings file.

  4. On the Publish Output page, select the Create a package on disk check box.

  5. In the What should the website be named? field, enter a name for the website.

    The default name is the application name.

  6. In the Where should the package be created? field, enter the UNC path for the location where you want the output to be published.

    The default location is the Publish subdirectory under your project directory.

  7. On the Security Settings page, choose the On option button to require a secure HTTPS connection, or choose Off if your application doesn’t need a secure connection, and then choose the Next button.

    For more information about security, see Security Considerations for LightSwitch.

  8. On the Database Configuration page of the wizard, select the Generate a new database called option and enter the name for the database.

    This must be the same name that you entered for the Application Name property in the Application Designer.

    Note

    If the database already exists on the server, select The application needs to update an existing database and enter the connection string for that database. If you do not have access to the server, you can enter a connection string for another database that has the same schema as the database on the server.

    Note

    When publishing updates, you don't need to republish the database unless you have changed the schema. To prevent the database from being republished, clear the Generate the SQL database script check box.

  9. If you have enabled authentication for your application, the Authentication page will appear. When you packaging an application for the first time, select the Yes, create an Application Administrator check box. When you package an update, select the No, an Application Administrator already exists check box.

  10. On the Other Connection Information page, update the connection strings for any additional connections as needed, and then choose the Next button.

  11. On the Specify a Certificate page, check the Sign the Xap File checkbox and select one of the three options for adding a certificate (.pfx) file. To publish without a certificate, leave the Sign the Xap File checkbox unchecked.

    Note

    Publishing your application without a certificate will cause a security warning to be displayed when an end user runs the application, and in some cases may prevent the application from running. For more information, see Signing a XAP File By Using a Certificate

    To add a certificate from your local store

    1. On the Specify a Certificate page, choose the Select a certificate from this computer’s store button.

      The Windows Security dialog box appears.

    2. In the Windows Security dialog box, choose the certificate that you want to use, and then choose the OK button.

      Basic information about the certificate appears. You can choose the More Details button to display more information about the certificate.

    To add an existing certificate from another location

    1. On the Specify a Certificate page, choose the Browse for a certificate button.

    2. In the Select File dialog box, browse to the location of the certificate that you want to use, and then choose the OK button.

      Basic information about the certificate appears. You can choose the More Details button to display more information about the certificate.

    To create a test certificate

    1. On the Specify a Certificate page, choose the Create a Test Certificate button.

      A password dialog box appears.

    2. Enter and confirm a password for the new certificate, and then choose the OK button.

      Basic information about the certificate appears. You can choose the More Details button to display more information about the certificate.

  12. Choose the Publish button to publish the application.

    When the application is published, a .zip file that contains the package is placed in the directory that you specified for the publish output. After this package has been created, a server administrator can use the MSDeploy tool to deploy the application to servers that are running IIS and SQL Server. For more information, see How to: Install a LightSwitch Application on a Server.

    Note

    If you have enabled authentication for your application, the application administrator must authorize users before they can run the application. For more information, see LightSwitch Authentication and Authorization.

See Also

Tasks

How to: Configure a Server to Host LightSwitch-Based Applications

How to: Install a LightSwitch Application on a Server

How to: Change the Application Type

LightSwitch Authentication and Authorization

Concepts

Deploying LightSwitch Applications

Signing a XAP File By Using a Certificate

Other Resources

Deployment: Distributing and Maintaining Your Application