Deploying 3-Tier Applications with Browser Clients using Visual Studio LightSwitch

Visual Studio LightSwitch support deployment of 2-tier and 3-tier desktop client (Out-of-Browser) applications and 3-tier browser client applications.

In the article  Deploying Visual Studio LightSwitch Beta 1 2-Tier Desktop Applications described an approach when you have a 2-tier LightSwitch application.
Post  Deployment of 3-Tier Desktop Applications with Visual Studio LightSwitch  is related with publishing of the 3-tier LightSwitch applications with Out-of-Browser clients.

This article, related with 3-tier LightSwitch applications using browser clients  completes the topic about deployment of the Visual Studio LightSwitch applications.

Like in 3-tier LightSwitch applications with a desktop clients there are two ways to deploy the application:

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

Steps are very similar like these for 3-tier LightSwitch applications with a desktop clients. There will be mentioned some differences.

In the sample is described also importing of the sample data from developer database to the deployed one.

Demo Application:

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

Requirements:

Visual Studio LightSwitch Beta 1:

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 a 3 application with a browser 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)

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 a 3 application with a browser client using a Package application.

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

 

  • Create a deployment package

Follow the same steps like in the article: Deployment of 3-Tier Desktop Applications with Visual Studio LightSwitch 

Select different name for database: InfraOrders2 (it will be used later in a data migration process).

 

Ensure that deployment package is created.

 

  • Deploy the application package on the IIS

The process is an identical like when deploying 3-tier LightSwitch applications with desktop clients.

 

Ensure that InfaOrders application is created on the web server.

 

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

 

Application runs inside a browser.

Sometimes data, used in development could be used from deployed applications.

Data migration from developer local database to the deployed database

There are several ways to do that. In this post is used approach when are generated
scripts used to import the data.

Attach the developer database to SQL Server 2008 via Microsoft SQL Server Management Studio.

 

 

For attached database select Tasks->Generate Scripts.

 

Follow the wizard.

In the “Choose Script Options” window for “Script Data” select “True”

 

Select only tables in the “Choose Object Types” screen.

 

In the “Choose Tables” screen select only tables with an application logic data.

 

Ensure that export is successful.

 

Open the generated script in Microsoft SQL Server Management Studio.

Change the name of the database with “InfraOrders2” and execute it.

 

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

 

   Enjoy! There is all data, used to develop the application.


Add a Comment

Please Login or Register to add a comment.