So I arrived... Yesterday the plane landed in Las Vegas and the first thing that I saw were... slotmachines! This is Vegas of course.
I'm staying in The Venetian and the hotel is gorgeous. After publishing this, I'll start taking some pictures and publish them on Flickr. You can already see some pictures from my trip to Las Vegas.
This morning I attended an EMEA meeting where they gave away some info that wasn't really useful. They announced that the Expression sweet is officially released tomorrow, but that's not really unexpected, as every attendee gets its own copy. I'll probably be visiting some brainstorm session later today. I think I'll head to bed early, as I'm still suffering from not sleeping for over 24 hours and of course the jetlag.
For all Dutch readers, you can also see a report of my trip to MIX07 and Las Vegas at my personal weblog.
Alice in wonderland, that's how I'm going to feel like in Vegas! Speaking about wonderland, via Alex I got a link to this post about the MIX07 Blogzone. In our hotel, The Venetian, on the third floor, there's going to be a room for bloggers with the following features:
This will be an excellent place that's hopefully not too crowded and where we bloggers can meet up! So if you're going, I'll be there with a large TechEd bag behind Windows Live Writer blogging about MIX'07 ;-)
On my WCF Introduction post I received a trackback to an example that should be really simple to start WCF with. I'm not here to judge the post (although I could ;-), but it got me thinking. Although I created some small posts on how WCF works, together it might still be too much for people that just want to see the simplest example. So this post is about that example.
There are two ways to present this. In this example I'll use as little code as possible in as few locations as possible. The other way is using the WCF Service Library project that comes with the VS2005 WCF Extension but requires a lot more code, text, etc. More about the in another post.
I'm not judging, but the other post by Ralf Sudelbücher has only one project containing both service, host and client. I'm using two projects, because WCF is all about getting clients to communicate with a service. Let's start.
using System.ServiceModel;
[ServiceContract]
class HelloService
{
[OperationContract]
string HelloWorld(string name)
return string.Format("Hello {0}", name);
}
1 static void Main(string[] args)
2 {
3 // We did not separate contract from implementation.
4 // Therefor service and contract are the same in this example.
5 Type serviceType = typeof(HelloService);
6
7 ServiceHost host = new ServiceHost(serviceType, new Uri[] { new Uri("http://localhost:8080/") } );
8
9 // Add behavior for our MEX endpoint
10 ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
11 behavior.HttpGetEnabled = true;
12 host.Description.Behaviors.Add(behavior);
13
14 // Create basicHttpBinding endpoint at http://localhost:8080/HelloService/
15 host.AddServiceEndpoint(serviceType, new BasicHttpBinding(), "HelloService");
16 // Add MEX endpoint at http://localhost:8080/MEX/
17 host.AddServiceEndpoint(typeof(IMetadataExchange), new BasicHttpBinding(), "MEX");
18
19 host.Open();
20
21 Console.WriteLine("Service is ready, press any key to terminate.");
22 Console.ReadKey();
23 }
using System.ServiceModel.Description;
1 private void button1_Click(object sender, EventArgs e)
3 localhost.HelloServiceClient proxy = new Client.localhost.HelloServiceClient();
4 string result = proxy.HelloWorld(textBox1.Text);
5
6 MessageBox.Show(result);
7 }
Congratulations, the most easy and fastest way to create a WCF service. Source-code can be downloaded here.UPDATE : The zip file was broken, but is now fixed again.
I'll be attending MIX'07 in Las Vegas this year as well as the parallel MDEC conference for Mobile development. One of my goals for this year is to do more with ASP.NET so Alex isn't the only one with all the knowledge ;-)
Some fun things are:
I'll keep you informed right here. For all Dutch readers, I'll try and post some stories at my personal weblog.