Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Once you have compiled your Silverlight application, you'll want to share it with the world. To do that you need to deploy it to a Web server. Microsoft has simplified the deployments by creating the XAP file format. The XAP file, as it is commonly called, contains all the necessary files for your application in a nice compressed format, just upload the XAP file to your server and you are ready to go. Well not quite, you are going to need a webpage to host your Silverlight content, I talk more about the host pages in an another movie in this series. You must also configure your Web server to deliver the XAP file when asked.
If you have Windows Server 2008 or newer, you are in luck as IIS on newer Microsoft operating systems is already configured properly. On other servers, including Apache, you'll need to set the MIME type for the XAP file extension. I'd like to talk for a minute about Microsoft Web servers. When you create and test a Silverlight application on your local computer, you're probably running the app in the ASP.NET Development Server. This is a local, lightweight server that understands ASP.NET, HTML, and Silverlight. Let me show you that.
I am inside Visual Studio and I have opened the solution called Deploying. This is a Silverlight application that contains a Companion ASP.NET website. When I go to my Debug menu and choose Start Debugging or press F5 that will launch the Development Server. If you look in the lower right-hand corner you can see the ASP.NET Development Server is running and showing the port that has been configured for my application. The Development Server is not full-featured or production ready. For that, Microsoft provides Internet Information Server or IIS, this is typically installed in servers, not local desktops or laptops.
On your developer computer you can install the new and free IIS Express. It matches the full IIS version feature for feature, but has less administration hassles. The point I want to make is this however, regardless of which server you use on your local computer, at some point you need to deploy your Silverlight app to a public server. As I said earlier that server must be configured to serve XAP by adding a MIME type to the server. In my Silverlight project, in my MainPage.xaml I have a comment that I have embedded there, that talks about the MIME type.
This was the first MIME type that Microsoft created and this says to register the XAP extension to this MIME type request. And then in later versions of Silverlight they added this second MIME type. Now here the number 2 or the -2 does not mean it's for Silverlight 2, it just means the second implementation of that MIME type. For my next demonstration, I thought I would remote desktop into a live server and show you how you could configure the MIME type settings. I am going to connect to one of my production servers, and on this server I have opened the IIS Manager, and I am going to work with this site here, shazzam-tool which is a Silverlight application, I have running on a website.
I am going to click on shazzam-tool and I am going to go to MIME Types and then I am going to scroll down and look for the XAP extension. I see it's already there. I can double-click on this to see configuration information about that. If the MIME type does not exist on this server I click on the Add link, put my extension in here and then my MIME type and then click OK. Since it's already configured on this computer I am going to click Cancel. Now your server is ready to send Silverlight apps to the user's computer.
You still need to upload your HTML or ASP.NET pages to the server. It will also need to copy the XAP file to the server. I am not going to show you how that's done as it will differ according to how you are hosting provider or IT department has configured the Web server.
Get unlimited access to all courses for just $25/month.Become a member