Configuring Windows 7 Machine to Host LightSwitch Web Applications

Most LightSwitch users want to deploy their Web applications to their own machine for testing and learning purposes. It is very easy to configure your machine to do so. In fact, you only need to do a few things. LightSwitch will do the rest. This post covers what you need to do to get your machine ready. My next post will cover the deployment process itself.

The instructions/examples are focused on Windows 7 and Internet Information Services (IIS) 7 and are intended for those who are in development, learning, or test mode. For full Web server configuration advice, check out Beth Massi’s post, “Deployment Guide: How to Configure a Web Server to Host LightSwitch Applications.”

These instructions assume you are using Windows 7 and have created your data entities in LightSwitch (intrinsic database). If your LightSwitch application uses external data, then ignore the bits on needing SQL server. In that case, you have already connected to a database.

What You Need

The basic components you will need to have installed are SQL Server (or SQL Server Express), Internet Information Services (IIS) 7, and .NET Framework 4.x.

  • If you don’t have SQL Server installed on your local machine, you can use any that you have access to. If you don’t have access to one, install SQL Server Express.
  • If you don’t have IIS installed, go to your control panel and enable it. (Very easy instructions)
  • Make sure you have .NET Framework 4.x. IF you don’t have it, get the latest here.

How Web Deployment Works

Publishing to the Web with LightSwitch is technically called 3-Tier Deployment. Your application is viewed in the browser on the client (Tier 1), it is hosted on IIS using LightSwitch application services (Tier 2), and uses data in the form of SQL Server or SQL Server Express (Tier 3).

Sound complicated? It’s not because we use LightSwitch. As long as you have the basics installed and configured (IIS, .NET Framework 4, and SQL Server or SQL Server Express), LightSwitch will do the rest.

Configuring Your Environment

There are just a couple things you need to do to make sure your environment is configured correctly: make sure your IIS application pool is using .NET 4.0, create a database, and set SQL Server to mixed authentication mode.

Setting up IIS

IIS hosts applications in application pools and each application pool has a property to specify which version of the .NET Framework to use. IIS’s Default Web Site is hosted by the DefaultAppPool and commonly uses .NET 2.0. Your LightSwitch application needs to use .NET 4.0 so you need to check the  .NET Framework version property and change it if necessary.

  1. Open the Computer Management console and expand the Services and Applications node.
  2. Select Internet Information Services Manager and the ISS page will open.
  3.  Expand the server node in the connections pane and select Application Pools. The list of application pools will open.
  4. Select DefaultAppPool, click Basic Settings, and set the .NET Framework version property to .NET Framework v4.x.
  5. Click OK to complete the change. You may also want to restart IIS for good measure.

That’s it. IIS is now ready!

Set up SQL Server

LightSwitch needs a database with mixed authentication to deploy correctly. Mixed authentication allows SQL or Windows authentication. You will see why when we get into the deployment process.

All you need to do is create a blank database and enable mixed authentication. I use SQL Server 2008 R2 and Microsoft SQL Server Management Studio, so these instructions use those applications.

Start by creating the database.

  1. Open your SQL Server management tool and connect to your server.
  2. Create a blank database by right-clicking on the Databases node and selecting New Database (the New Database window will open)Name your database and click OK.

Now set the authentication mode.

  1. In the management screen, right-click on the server node and select Properties.
  2. This will open the Server Properties window.
    In the Server Properties window, select Security from the page menu and click the SQL Server and Windows Authentication mode radio button.
  3. Click OK.

You Are Ready to Deploy

Those few steps are all the prerequisites you need to start the Web publishing process in LightSwitch. My next post will cover that process.

Advertisements
Tagged , ,

2 thoughts on “Configuring Windows 7 Machine to Host LightSwitch Web Applications

  1. Hmm it appears like your site ate my first comment (it was super long) so
    I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new to everything. Do you have any tips and hints for inexperienced blog writers? I’d genuinely appreciate it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: