Click here to Skip to main content
Click here to Skip to main content

How to Deploy a Silverlight 4 App Connected to a Database

, 14 Jun 2010
Rate this:
Please Sign up or sign in to vote.
Deploying a Silverlight 4 application connected to a Database


This article shows how to deploy a Silverlight application 4 connected to a database. We are going to use IIS 7.5 to do it.

I was stuck a whole week dealing with the following error:

"System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed fore query 'GetProducts'.... Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed"

Probably someone else will face it, and that is why I decided to write the solution. Hope it helps!


Let’s imagine that we have finished our Silverlight application using Visual Studio 2010 and the .NET Framework 4. We have a few views and an MDF database in our App_Data folder. It would look like this:


So, let us now deploy our application.


If you are familiar with deploying ASP.NET, then you’ll find this easy to do. So, we’ll right click our web project in the Solution Explorer and let’s click Publish.


This will open up a dialog window. We can create publishing templates. Let’s just choose the location where we are going to publish our application (our computer, a web server, FTP…). I like to check the “delete existing files in the destination folder before publishing” option. Click the Publish button.

Now we are ready to work with the IIS configuration (I'm using Windows 7).

Let’s open the Windows Start Menu, and type “inetmgr” in the search box. The IIS Manager Window will show up.

Go to the MIME Types.


In the appearing list, we’ll need to include the following types (XAML, XAP, XBAP) as shown in the image below:


Now, in the left menu, let’s go to Sites, and let’s add our Web Site (as default site, virtual directory… based on our own needs). When done, let’s click in our application, like this:


In the menu that appears on the right side, we’ll click the “Advance Configuration” link. Now, in the dialog, we’ll click in “Application Group”, and you’ll notice that a button with three dots will appear on its right. Click that button and you will see another dialog. Select ASP.NET v4.0, as shown in the image below:


If ASP.NET v4.0 is not selected, and you leave DefaultAppPool as I did in the beginning, you will get the following error message every time your application tries to connect with the database: “There is an error in the service with the Get function..”

So, now that we selected our Application Group, let us configure it. In the left panel (back in the IIS Manager Window), right above our Default Site, we’ll see “Application Groups”. Click it. A list will appear in the center panel. Let’s open the ASP.NET v4.0 and select the right framework version. Click ok and select it again, but instead of opening it, this time we’ll go to the right panel, and we’ll click on “Advance Configuration”:


Change the Local System and select Network Service, as shown in the image above. And that’s it! Now we are able to access our data from our Silverlight 4 application without getting any error from the Web Server.

Hope it helps!


  • 14th June, 2010: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Spain Spain
No Biography provided
Follow on   Twitter

Comments and Discussions

QuestionSame Error .. PinmemberPritesh Aryan3-Jun-12 19:39 
GeneralThank you! PinmemberAGWilliams10-Jan-12 4:02 
GeneralRe: Thank you! Pinmembernereo.lopez10-Jan-12 6:11 
I'm happy to hear that. Thanks for you positive feedback. Regards!
QuestionHosting silverlight application... PinmemberThe nk21-Oct-11 4:07 
GeneralComments PinmvpMd. Marufuzzaman14-Jun-10 6:06 
GeneralRe: Comments Pinmembernereo.lopez14-Jun-10 6:26 
GeneralAbout article. PinmemberShumer14-Jun-10 4:41 
GeneralRe: About article. Pinmembernereo.lopez14-Jun-10 5:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 14 Jun 2010
Article Copyright 2010 by nereo.lopez
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid