This post assumes that you have a VPS or Dedicated Windows Server hosted and you want to host your LightSwitch Application on it.
Requirements:
Development Machine:
- Visual Studio with LightSwitch
- IIS 6/7/8
- Microsoft Sql Server
- WebDeploy
- Web Platform Installer
To install WebDeploy we will be using Microsoft’s Web Platform Installer (WebPI) 4.0. You can download WebPI here.
Once you’ve downloaded WebPI, launch the installer. In the search bar, type in, “Recommended”. We want to select “Recommended Configuration for Hosting Providers” by clicking Add…
If you click the “Items to be installed” link at the bottom, you can see a list of what will be installed. Anything the has an “X” beside it can be removed. For example if you do not want or need PHP and its components you can remove them.
Notice the WebDeploy features about half way down:
In this walkthrough, I’ll be leaving all the components for this configuration. Next, click Install. Then, once you Accept the License Agreements, your installation will begin:
Once that completes, you can close WebPI.
Next we’ll want to create a local non-admin user that we will use with WebDeploy. Open Server Manager, and then select Computer Management.
Once Computer Management loads, navigate to Local Users and Groups, then right-click the Users folder and select New User. In my example, I created a new user “GabeWebDeploy”.
Make sure you remember or document this password. You’ll need it later.
We also should go ahead and create a WebDeploy folder to contain our Publishing settings for later. I created a WebDeploy folder in: C:\inetpub. This simplifies the management of Publishing Profile management.
Next, open up IIS Manager, Control Panel > Administrative Tools > IIS Manager. When you launch IIS Manager, you will get the following prompt:
Click the “Do not show this message” checkbox if you would like and then click “No” hown above. Clicking Yes will just take you back to the website where you download Web Platform Installer.
For this walkthrough I also created a new website, “Gabe OW Webdeploy Test”. We now need to edit the WebDeploy Publishing Settings. To do this, select your site and then right-click Deploy > Configure WebDeploy Publishing…
Now we need to change some settings here on the Configure WebDeploy Publishing window:
Click the … next to the top line that begins with Servername\Username. We want to change this to the new WebDeploy user we created earlier.
Pro Tip: We want to use a non-administrator account and NOT and administrator level account, as we want to contain the server access of the user account to this site/application for security purposes.
As of this writing in the Server 2012 RTM version, you’ll need to enter the username in the Servername\Username format as the clicking the Select… function will close IIS. This appears to be a bug.
After you enter the username, go to the line that says, “Specify a location to save the publish settings file” and change the path to the WebDeploy folder we created earlier. Change “C:\Users\Username\” to new path: “C:\inetpub\Webdeploy\”. Then click Publish. See screenshot example:
After you click Setup a publishsettings file will be created at that folder.
Copy that file into the Development Machine.
Publishing Using Visual Studio
Open your project in VS Lighstwitch.
Right Click on the properties of the project and click publish.
In the Application Server Configuration click on Import Settings and select the publish Settings file.
Then in the database connection pane click the button highlighted below.
It will take you to the database connection settings.I suggest you to do this way because it will remove any anomalies that may occur in connection string due to human error.
Then click on the publish to publish the app to server
ENJOY :)