Combining Silverlight 4 and Umbraco pt. III: Final preparations and copy/pasting

Alright, so far so good! J In this last part of my blogposts about running Silverlight with Umbraco as backend I will go through the final steps to get the application up and running.

When everything builds nice and smoothly it’s time to change the path to the services in the Silverlight application. These paths can be found in the config file called ‘ServiceReferences.ClientConfig.’ This config file shows you the bindings and endpoints to the services you’ve referenced in your project. What we need to change here is that it tries to find the services on the endpoint: localhost:1234/Services/MenuService.svc. We need to tell it to look for the service at “/Services/MenuService.svc” since we will be placing the service folder in the root of our website:

After this is done, we need to build our solution and copy over some files in order to get the Silverlight application to run in Umbraco.

First off, we need to open the default webpage in our website that hosts the Silverlight application and copy everything except for the first line: <%@ Page Language=”C#” AutoEventWireup=”true” %> we don’t need that.

In Umbraco we will copy this into the Silverlight Homepage template found under Settings -> Templates -> Silverlight Homepage (in my case). Going through the pasted code you will see that it’s the code that’s hosting the Silverlight application (.xap file) and if we take a look at the path to where it’s looking for the xap file it should say: “ClientBin/SilverlightUmbraco.xap”. So this will be the next thing to copy over.

Going to the websites project folder, we have to copy the Silverlight.js file and the ClientBin, Model, and Services folders to the root of the Umbraco website:

Also, in the bin folder, we need to copy over the .dll file to the bin folder in the root of the Umbraco website.

The last thing to copy is found in the web.config file in the website that hosts the Silverlight application. We have to copy the <system.serviceModel></system.serviceModel> snippet in order to make the services available. So copy the following snippet:

And paste it into the web.config file found in the root of the Umbraco website right under the </system.web> end tag.

To make sure the services are running as expected we can go to the following url: http://yourdomain.com/Services/MenuService.svc and you should see a screen that represents the service which indicates that it’s running.

That’s it – the Silverlight application should start up as soon as you hit the domain.

If you have any questions or want to discuss anything about these blogposts, please feel free to contact me on info@nuanceweb.dk or mail@bo-mortensen.dk and I will be happy to talk it over with you since there’s possibly a lot of other ways to run Silverlight with Umbraco.

Thanks for reading! J

This entry was posted in Silverlight, Umbraco CMS. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


one + 9 =