Hosting Silverlight and WebService

Apr 7, 2009 at 8:52 AM

I have a Silverlight-Project in Visual Studio 2008:
- SilverlightClient (this calls the WebService Service.svc)
- SilverlightClient.Web (this project contains a WebService Service.svc)
Is it possible to host such a configuration under C# Web Server? And how? Is there any sample or tutorial?
I've spent now some days to get it running, but no way, doesn't work. Well I'm a newbie with setting up web servers.

My code for the Web Server is:

string basePath = ConfigurationManager.AppSettings["basePath"]; 
string baseUrl = ConfigurationManager.AppSettings["baseUrl"];
string port = ConfigurationManager.AppSettings["port"];
string ipAdr = ConfigurationManager.AppSettings["ipAdr"];
IPAddress ipAddress = IPAddress.Any;
if (!ipAdr.Equals(string.Empty))
IPAddress.TryParse(ipAdr, out ipAddress);
    server =
new HttpServer.HttpServer(); 
FileModule fm = new FileModule(baseUrl, basePath); 
"manifest", "application/manifest"); 
"dll", "application/x-msdownload");
"application", "application/x-ms-application"); 
"xbap", "application/x-ms-xbap"); 
"deploy", "application/octet-stream"); 
"xps", "application/"); 
"xap", "application/x-silverlight-app"); 
"xaml", "application/xaml+xml"); 
    fm.MimeTypes.Add("svc", "text/xml; charset=utf-8");
catch (Exception ex)
    Console.WriteLine(string.Format("Couldn't start webserver: {0}", ex.Message)); 
Console.WriteLine("Webserver started at:"); 
Console.WriteLine("Stop by pressing any key"); 


This way, I get an error stating, that a name may not start with "%".
The Service.svc looks like this:

<%@ ServiceHost Language="C#" Debug="true" Service="SilverlightWcfClient2.Web.SilverService" CodeBehind="SilverService.svc.cs" %>

I think I'm missing some parts but have no idea where to start.
Any help would be appreciated.

Apr 7, 2009 at 1:15 PM
That's a ASP.Net string. You need to create a ASP.Net module for the webserver to get that working. Check Cassini webserver for example.