Deployment of 3-Tier Desktop Applications with Visual Studio LightSwitch

[Infragistics] Mihail Mateev / Saturday, October 9, 2010

Visual Studio LightSwitch applications Deployment process could be different depending on the application topology. In the article  Deploying Visual Studio LightSwitch Beta 1 2-Tier Desktop Applications was described an approach when you have a 2-tier LightSwitch application.  Probably more interesting are cases when you have 3-tier desktop or browser applications.

There are three types of LightSwitch applications by deployment:

  • LightSwitch application with a desktop client (Out-of-Browser Silverlight application) and 2 tier deployment.
    (creates an application that runs on the end-user’s Windows desktop; the database and server components run on a networked computer)
  • LightSwitch application with a desktop client (Out-of-Browser Silverlight application) and 3 tier deployment.
    (creates an application that runs on the end-user’s Windows desktop; the database and server components run on an Internet Information Services (IIS) server)
  • LightSwicth application with a browser client (Silverlight application) and 3 tier deployment.
    (creates an application that runs in the end-user’s web browser; the database and server components run on an Internet Information Services (IIS) server)

This article will examine ways of deployment of the 3-tier desktop LightSwitch applications .

Generally there are two ways to deploy a LightSwitch application, by either publishing or packaging it:

  • 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.
  • A packaged application means that everything that is required to run the application is bundled together, but additional steps must be taken to make the application available to the user.

To be possible to deploy a 3-tier LighSwitch application you need to have except SQL 2008 Server also IIS 7 on Windows Server 2008 or Windows 7.
(Publishing of the 3-tier LightSwitch application is supported only for Windows 2008 Server in Visual Studio LightSwitch Beta 1. For Windows 7 is supported only deployment via creating of a deployment package. For 2-tier LightSwicth applications are supported both using a package and publishing).

More in formation how to deploy 2-tier desktop applications you could find in the article: Deploying Visual Studio LightSwitch Beta 1 2-Tier Desktop Applications

Sample Application:

Demo application is based on the application used for article: “Introduction to Visual Studio LightSwitch”

Requirements:

SQL Server 2008 Express or higher license

IIS 7 on Windows 2008 Server or Windows 7

Steps to reproduce:

  • Download a sample application from the article: “Introduction to Visual Studio LightSwitch”
  • Set an IIS to provide a web deployment (demo uses Windows 7 with IIS 7)
  • Deploy the application as 3 tier application with a desktop client using a Package application .

 

(LightSwitch Beta 1 provides Publishing of the 3 tier applications only for Windows 2008 server now. It is expected RTM to support Publishing
for Windows 7. This demo application is created on Windows 7 with IIS 7 and deployment is based on a package application)

Set an IIS on Windows 7 to provide a web deployment

To be possible to deploy applications on the IIS you need to install Web Deploy . More detailed information how to install and set this tool and IIS you could find in the article Automating Deployment with Microsoft Web Deploy.  

Deploy the application as 3 tier application with a desktop client using a Package application option.

In the InfraOrders project –> Properties –> Application Type: Select the option: Desktop client, 3-tier deployment.

Open the InfraOrders solution: From the context menu over InfraOrders select “Publish”.

Ensure the 3-tier topology on welcome screen

On the “Specify Publishing Preference” screen select an option “Select a package on disk”.

On the “Specify Application Database” specify the name of the database.
It could be with a different name from the original one.
(In the sample the same name like in the original database is selected: InfraOrders.)

When deployment is finished ensure that a deployment package exist under [Your Application Path]\Publish folder.

In the IIS Manager for the selected web site (Default Web Site in this case) select in the context menu Deploy –>Import Application.

Select the generated application package

In the “Select the Contents of the Package” ensure that all options are selected.

Enter application package information: database name (InfraOrders), application path (InfraOrdersCustom), user
and password to connect to the database.

Wait until deployment was finished:

Ensure that a new web application “InfraOrdersDesktop” exist on the default web site.

Run the application using [Server Name]/InfraOrdersCustom path.

At first time application needs to be installed.

 Application is started after a successful installation.