views:

758

answers:

5

Is there a way to embed a web server, or other means, in a .NET application so that the GUI could be presented as a Silverlight application? Currently we have an application that is client/server. We are using sockets to communicate and passing messages back and forth. One thought was to rework this as a Silverlight solution. The user would simply point their browser at the server on a specific port and be connected.

I could use IIS to serve up the Silverlight (XAML) but was hoping there was another way to do this via embedding a web server or something.


EDIT - Further explaination:

We decided to construct the new version of the application in WPF but are new to Silverlight & WPF. Traditionally, we would have constructed this type of app using a Windows Service on the server and a Windows Forms app on the client and each would communicate through sockets. By "this type of application" I mean a Windows service that processes "stuff" and a client app that allows you to configure the serivce and to view its current status etc. I thought that instead of building the socket layer and having to parse messages, as they go back and forth between the client and server, we might be able to build a Silverlight app and have the user simply connect to the server via their browser. This would mean that I didn't have to install a client app (other then Silverlight) and would remove the communications layer. The crinckle is that I'd like to remove the dependency on the server having IIS and any configuration we might need to do to IIS.

Maybe I'm looking at this all wrong...could be my 'newness' to WPF/Silverlight/XAML


+1  A: 

.NET does provide the plumbing needed to implement a HTTP server without extreme difficulty.

Here is one such code project example.

AnthonyWJones
A: 

Checkout this link on building an out-of-browser Silverlight app: http://msdn.microsoft.com/en-us/magazine/dd882515.aspx

IanT8
+4  A: 

Silverlight is just a standard HTML <object> so it can be delivered by anything that will serve HTML. However, it seems like a strange architecture for a client/server solution. For what you're describing, I'd look at either:

  • Silverlight out-of-browser application
  • WPF application delivered via ClickOnce
  • Silverlight application that is loaded from a website but communicates with your existing backend using Silverlight's socket support

Can you explain why you're looking at building a custom server instead of one of the above approaches?

Jon Galloway
Thanks for your suggestions, I've added a little more detail to the question that might help clarify why I'm asking this.
Douglas Anderson
Thanks. Why don't you want to run IIS? You can host a Silverlight application on any webserver, if it's the OS/licensing - Apache, etc.
Jon Galloway
+1  A: 

If I understand your requirements correctly, a Silverlight 3 out-of-browser app would give you the best of both worlds:

  • easy to install
  • easy to push out to users
  • can be launched from start bar/desktop shortcut
  • can run offline (they call it detached state), so if your server is down you can notify users nicely through the local app, rather than them browsing to the online SL url and getting a 404.
  • local storage
  • easy to push application updates out
Alex
A: 

Douglas, Were you able to find a way to make this work? I have a similar situation and was curious to see if you had a resolution.

Thanks.

Matt
We ended up doing the final app as WPF using sockets. We looked at other options but this seemed the simplest to implement based on our requirements.
Douglas Anderson