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 abbbout 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.

  • 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.

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 Build menu, click Publish <Application Name>.

    The LightSwitch Publish Application Wizard appears.

  2. On the Welcome to the LightSwitch Publish Wizard page, choose either Desktop or Web, and then click Next.

  3. On the Application Services page, choose IIS Server. If you are not sure that the server running IIS has the necessary prerequisites installed, uncheck the IIS Server has the LightSwitch Server Prerequisites installed checkbox and click Next; otherwise leave it checked and click Next.

  4. On the Specify Publishing Preference page, select the How do you want to create the website? section, click Remotely publish to a server now.

    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, check the Allow untrusted certificate check box. If you are deploying for production, leave the Allow untrusted certificate check box unchecked, and then click Next.

  9. On the LightSwitch Application Data – SQL Database Connection 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 click Next.

    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.

  10. If you have enabled authentication for your application, the Authentication page will appear. To configure authentication information, see the "To publish authentication information" procedure here: How to: Create a Role-based Application.

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

  12. 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. 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, click the Select a certificate from this computer’s store button.

      The Windows Security dialog box appears.

    2. In the Windows Security dialog box, select the certificate that you wish to use, and then click OK.

      Basic information about the certificate is displayed. You can click the More Details button to see more information about the certificate.

    To add an existing certificate from another location

    1. On the Specify a Certificate page, click 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 wish to use, and then click OK.

      Basic information about the certificate is displayed. You can click the More Details button to see more information about the certificate.

    To create a test certificate

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

      A password dialog box appears.

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

      Basic information about the certificate is displayed. You can click the More Details button to see more information about the certificate.

  13. Click Publish to publish the application.

    Once the application is published, users can install the application from the web site specified by the Site/Application name. For a desktop application, the user will be prompted to click 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 web 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 How to: Create a Role-based Application.

To package a 3-tier application

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

    The LightSwitch Publish Application Wizard appears.

  2. On the Welcome to the LightSwitch Publish Wizard page, choose either Desktop or Web, and then click Next.

  3. On the Application Services page, choose IIS Server. If you are not sure that the server running IIS has the necessary prerequisites installed, uncheck the IIS Server has the LightSwitch Server Prerequisites installed checkbox and click Next; otherwise leave it checked and click Next.

  4. On the Publish Output page, in the How do you want to create the website? section, select Create a package on disk.

    The Details section appears.

  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 publish output to be located, and then click Next.

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

  7. 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.

  8. If you have enabled authentication for your application, the Authentication page will appear. To configure authentication information, see the "To publish authentication information" procedure here: How to: Create a Role-based Application.

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

  10. 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, click the Select a certificate from this computer’s store button.

      The Windows Security dialog box appears.

    2. In the Windows Security dialog box, select the certificate that you wish to use, and then click OK.

      Basic information about the certificate is displayed. You can click the More Details button to see more information about the certificate.

    To add an existing certificate from another location

    1. On the Specify a Certificate page, click 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 wish to use, and then click OK.

      Basic information about the certificate is displayed. You can click the More Details button to see more information about the certificate.

    To create a test certificate

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

      A password dialog box appears.

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

      Basic information about the certificate is displayed. You can click the More Details button to see more information about the certificate.

  11. Click Publish to publish the application.

    Once the application is published, a .zip file that contains the package is placed in the directory that you specified for the publish output. Once this package has been created, a server administrator can use the MSDeploy tool to deploy the application to servers 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 will have to authorize users before they can run the application. For more information, see How to: Create a Role-based Application.

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 Deployment Topology and Application Type

How to: Create a Role-based Application

Concepts

Deploying LightSwitch Applications

Signing a XAP File By Using a Certificate

Other Resources

Deployment: Distributing and Maintaining Your Application