Tuesday, January 27, 2009

.NET Services Whitepapers

Our good friends at Pluralsight wrote some great whitepapers that introduce developers to .NET Services.  They are all available on the .NET Services MSDN Dev Center.  The best place to start is Aaron's intro, and then based on what you're interested in, there's a paper on each of the .NET Access Control Service, .NET Service Bus, and .NET Workflow Service

Happy reading!



Tuesday, January 27, 2009 11:52:17 PM (GMT Standard Time, UTC+00:00)  #  Comments [1] 
 Saturday, January 03, 2009

Windows Live Writer

I normally use dasblog's web interface to write blog entries, and find it to be adequate from a formatting perspective, and convenient because it's just a web app that I can run from anywhere.  I decided to try out WLW to see whether there is any advantage in using a "rich client" app for creating blog entries. 

I have to say it's a cool little app.  It doesn't give me much in the way of formatting beyond the standard web interface to dasblog, but it has a couple of goodies, like adding block quotes, tables, and tags. 

The biggest feature for me is the ability to type a draft and have it saved, even if publishing to the blog fails for some reason.  I've certainly had my share of blog entries that didn't get posted properly using the dasblog web interface, and even if I remember to keep the text in my clipboard before posting, it's still annoying to have to recreate any formatting.  So that feature alone makes WLW worth it for me.

There are a couple of other features that are missing some obvious integration with popular websites.  For example, inserting a video offers integration with MSN Video Soapbox, but not with youtube.  It would also be nice to have the "insert picture" functionality integrate with something like Flickr.  But wait a minute - that functionality does exist... in the way of a user-written plug-in :-)

Which brings me to the coolest feature of WLW - the extensibility.  The WL gallery has 112  plug-ins that include integration with Flickr, the ability to insert properly formatted code (from VS or from the clipboard), firefox integration, format a picture as a polaroid, and many others.

The other interesting thing is how much of dasblog's functionality is exposed via web services, and how well WLW integrates with those web services.  For example, the categories are all downloaded when I first set up WLW with my blog.  That really lives up to the vision of having a web services layer that's consumable from either a rich client app or from a web interface.

del.icio.us Tags:


Saturday, January 03, 2009 8:01:47 AM (GMT Standard Time, UTC+00:00)  #  Comments [1] 
 Friday, December 19, 2008

Service Bus in Azure

Martin Heller posted a nice article about the Azure Services Platform CTP's.

Martin did a good job talking about what pulls the platform together... it's a set of loosely coupled services, that offer standard (REST / SOAP) API's that are easy to consume from any platform.  You can use all of these services separately (e.g. use the SQL Data Services from an app hosted on GoDaddy), but the idea is that Microsoft gives you a single, cohesive platform to build cloud-based or cloud-aware applications, including being able to host web pages and (WCF) web servcies, being able to authorize access to those services, being able to exchange messages between those services and any other applications...

Martin characterized .NET Services in the following way:

.Net Services include the .Net Access Control Service, which controls access to Web resources using security tokens; the .Net Service Bus, which is a discoverable registry of Web end points; and the .Net Workflow Service, which is a sequential workflow controller.

I think the descriptions for Access Control and Workflow are good, but the Service Bus bears further elaboration.

The way I would describe the Service Bus is as a firewall-friendly, Internet-scale pub-sub messaging system.  What you do with the Service Bus is quite simple.  Just like in any Enterprise Service Bus, you have subscribers or receivers that listen to messages coming on a particular address, and you have publishers or senders that can send messages to that address.  You can have one or more subcribers - one subscriber is just a degenerate case of the more general "one-to-many" pattern.

So what is new and different about this kind of Service Bus?  It allows you to send and receive messages across any network topology, and facilitates security across trust domains.  For example, I can have a receiver sitting behind a corporate firewall, and the sender be a .NET Workflow Service (using the CloudServiceBusSend activity).  The Service Bus automatically ensures delivery of the message.

The nice thing is that the sender or receiver doesn't have to be a .NET application - it can be a Java app or a Ruby app.  We have SDK's for those posted on our portal.

So we have this Service Bus in the cloud, but in order to make it usable by .NET developers, we've added some .NET classes that integrate it with WCF, the .NET communications framework.  That integration comes in the form of a Service Bus binding, which is a peer to the existing bindings (basicHttpBinding, webHttpBinding, wsHttpBinding, etc). 

The simplest thing you can do with that binding is to put your service on the Internet.  By adding a Service Bus endpoint to your list of endpoints, you are effectively giving your service an Internet-accessible address, even if your service is sitting behind a firewall.  That's because Service Bus has a relay built-in.

Building a multicast system is just as easy.  A listener is simply a service that uses the Service Bus binding to listen on a particular address, and there can be more than one.  A sender is simply a client-side proxy that sends a WCF message to that address.  It's really as simple as that.

What is that address, you may ask?  Very simple.  Your .NET Services account has a name.  Martin's was evidently called "iw_mh_azure".  Martin effectively owns sb://servicebus.windows.net/iw_mh_azure and everything under it. He can pick any address he wants as long as it's under that root in the service bus namespace.  That's why the accounts have to be unique :-)

So you may ask, what is Martin talking about when he mentions this "discoverable registry of Web end points"?

It turns out that Service Bus has one additional cool feature, which is that you can configure a service that uses the Service Bus binding to automatically add itself to an AtomPub Service Document that we have at the root of your portion of the Service Bus namespace.  So Martin could create a service called HelloWorld and give it the address sb://servicebus.windows.net/iw_mh_azure/HelloWorld, and if he navigated to http://servicebus.windows.net/iw_mh_azure, he'd see an AtomPub feed with an entry for that service.  And if that service supported GET and returned an AtomPub feed, Martin (or any of his users) could navigate that AtomPub document.  While cool, I don't think of this feature as the most important one, hence this blog post :-)

That's about it... if this all sounds interesting, go to www.azure.com and follow the sign-up instructions.  We make you sign up on Microsoft Connect, but we've basically caught up with the waiting list and have provisioned almost everyone that's signed up with a .NET Services / SQL Data Services account, so your wait shouldn't be long...

Happy coding :-)


 |  | 
Friday, December 19, 2008 1:37:02 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Wednesday, December 17, 2008

Win7 Rocks

Win7 has this super cool feature where you can boot from a VHD. 

As part of their build process, the Windows team produces VHD's as well.  Since I work at Microsoft, I'm lucky enough to be able to pick up any daily build and try it out, risk free.  Meaning - I don't have to upgrade my existing host OS (Vista sp1), or run Win7 in a VPC (slow), or install Hyper-V and run Win7 as a guest OS (shares resources, especially RAM, with the host).  Instead, I just boot Win7 on that PC, and it just works as if I had installed Win7 side-by-side with Vista.

The fact that Win7 is in a VHD file instead of installed "natively" on the disk doesn't seem to result in any palpable performance difference. 

I can still access all my Vista documents/data on the C drive, because Win7 mounts itself on the D drive.

And if Win7 didn't work for me, I could simply reboot and have my old machine back exactly how I left it.

But now that I've started using Win7, I'm not going back.  It's still an internal build (pre public beta), but already I find that it is just as stable as any OS I've ever run (W2K3, W2K8, XP, Solaris, RH Linux... sorry I'm not a Mac user :-)).  Just for comparison, at this point in the Vista product cycle when I started dogfooding it, I used to get bluescreens (mostly bad video drivers).  It's great to see this level of stability at this place in the product cycle.

Perf is good.  I don't know how much faster Win7 would be if I didn't run it from a VHD, but even if it's exactly the same perf as I get now, I have to say that things seem to be significantly snappier than Vista.

The "chrome" is a step forward from Vista (not a big overhaul but alot of smaller tweaks that really make a difference - e.g. the taskbar improvements where you can click on the IE icon, and it shows you a side-by-side preview of all the IE windows/tabs that you have running, so you can decide which one you want to switch to).  Even the applets got a facelift (wordpad and paint have a ribbon, calc actually has a programmer mode... :-))

IE8 still needs a bit of work - there are still pages that don't display well until I use compatibility mode.  For example, it appears that Windows Cardspace doesn't come up unless you're viewing the page in compat mode.

So far, I'm very impressed.  I'm now running Win7 on both my laptop and my work desktop machine, and it took me a small number of hours to get both up and running (including installing all the apps I use, like Office, Visual Studio, iTunes, etc).

If you happened to go to PDC and got the Win7 CD, and haven't had a chance to try it out yet - just do it - you'll like it :-)



Wednesday, December 17, 2008 8:04:19 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Friday, August 15, 2008

WCF 101 Screencast

Cliff, our stud WCF product manager, just posted a Channel9 video where Aaron goes through the process of creating a WCF service from scratch.  The video is nice in that it isn't just a typical "let's race to do something really simple in under a minute", but actually goes through setting up contracts, configuring the service with an endpoint using the config tool, and hitting it with the test client.  Good introduction for someone who's familiar with .NET but has never written a WCF service.

BTW, the Pluralsight guys have created another shirt I have fun wearing... the first one being the one with the caption /{real}/{webservices}/{use}/{uris} :-)

Rumor has it that Jon was responsible for creating and sending a box of them over... thanks!  (and of course to Matt/Moustafa for delivering...)


 | 
Friday, August 15, 2008 5:51:57 AM (GMT Standard Time, UTC+00:00)  #  Comments [2] 

Time to Outsource my Blog :-)

I run my own blog server from home.  It affords a nice degree of flexibility in that I can really control the software I put on there, and customize it for my purposes.  For example, I was able to mess around with the dasblog code, and add WCF-based endpoints for RSS/Atom, as well as create my own support for logging in and leaving comments with CardSpace.

There are some big downsides too though.  One is that I have to maintain my own software on the blog server.  Back in July 07 I decided to repurpose an old 4-proc machine I had as my blog server, and installed Windows Server 2008 RC1.  That proved to be a rock solid OS and I got to play around with WS08, which was fun... but a few days ago, I discovered that I couldn't mstsc into the machine anymore, so I tried to log in manually, and found out that my RC1 license key expired.  Doh! 

I tried to put in an RTM license key, but that wasn't recognized as valid (I guess that makes sense).  The OS was nice enough to let me do a "limited login", which means get a browser window that opens up to the licensing site, where you can get a valid license key.  But we already established that an RTM license key wasn't going to fix the problem, so I needed to figure out how to upgrade the software.  Fortunately, I could do anything from that browser window, including typing "c:\windows\system32\cmd.exe" :-)  from there I was off to the races.  Back up all the data on the machine (took a couple of tries, because the machine seemed to time out every once in a while and kick me off). 

Then I had to round up a copy of WS08 Enterprise RTM (thanks Jason!) and tried to upgrade the OS.  Again, took a couple of tries, but at the very very end, somehow the upgrade process failed (argh) and I realized I had to do a fresh install.  Oh well, I backed up all the data, what could go wrong?

Well, everything works fine, I install the app server and webserver roles, get it all working, set up the default web site correctly, create a new application for dasblog... try to hit the webserver from outside, no dice.  Ping works, HTTP.  Did the IP address change somehow?  No.  Are all the NT ACL's set up right?  Yes.  Hmm.  I go to the router to see whether it's still configured to forward traffic to the right server... oh, that's the problem - I forgot to configure the machine with a static IP address.  OK, now HTTP works - yay!

Next let's get HTTPS working.  Darn, forgot to export that certificate!  I knew I'd forget to back something up.  Since my root address is https://www.gazitt.com/blog, all my links are now broken (including all <img> tags).  So now I have to re-request a cert from eNom, and that takes a day.  Net - the site is basically impaired for a good 24 hours.  (Note to self - export cert tonight! :-)

Moral of the story: running my own blog server is probably not worth the hassle... now I need to figure out which server I want to use :-)  asp.net?  MSDN?  PluralSight like all the cool kids?  I'll definitely need to figure that out before the PDC :-)



Friday, August 15, 2008 5:31:59 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Monday, August 11, 2008

Visual Studio 2008 and .NET Framework 3.5 SP1 RTM Today!

Today, we’re proud to announce the availability of the “gold” bits of VS 2008 SP1 and .NET 3.5 SP1.  We think this is a great update to our VS2008 and 3.5 releases that is well worth checking out. 

I blogged about the new features for Service developers back in May when we shipped the beta, so I won’t repeat them all here… but here is a recap of some of the highlights:

On the Web front, we’ve built on the support for REST and AtomPub with enhancements to UriTemplate and support for AtomPub ServiceDocuments, respectively.  And of course we’ve built Data Services (also known as “Astoria”) – a WCF service that exposes any SQL database (or LINQ provider) as a set of AtomPub resources.  Finally, we’ve enhanced our support for partial trust scenarios with the ability to write to the event log, which helps debugging and diagnosability. 

The DataContractSerializer has some nice enhancements, including support for “POCO” (plain-old C# objects) contracts, which allows using this serializer without requiring you to decorate members [DataMember].  This is more than just a convenience – sometimes you don’t control the class you are trying to serialize (for example, it gets generated by a tool which doesn’t slap on the [DataMember] attribute), and this feature now makes it possible to use the DataContractSerializer with those types.  We also added support for serializing object graphs in a way that is more interoperable with JAX-WS, and support for ADO.NET Entity Framework types in DataContracts. 

There’s also some good perf work in this release.  If you’re running in IIS7 integrated mode, we’ve seen 5-10X scalability increases for WCF services via a new asynchronous implementation of our HttpHandler/Module (more details on Wenlong's blog).  Also, the Workflow designer can handle significantly bigger workflows and loads up much faster.

Finally, we have some nice improvements in our tools.  Our Test Client now runs standalone (in addition to running inside Visual Studio).  We also added support for a bunch of new types including Nullable types, Dictionaries, MessageContracts, and XmlSerializer contracts.  The tool also supports WS-RM sessions and allows you to customize the config file for the tool itself, so you can save some common customizations instead of having to recreate them.

The support for XmlSerializer-style contracts opens up some interesting new scenarios for the tool… My favorite is pointing it at a public web service to discover its contract, and use the tool kind of like a browser – i.e. be able to invoke a service with the right parameters and look at its output.  You can find the standalone version of the tool in <Program Files>\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe.  Here’s an example of pointing the tool to the Amazon AWS WSDL and invoking the ListSearch operation to retrieve a WishList for John Doe:

We also added a new publishing wizard for WCF Service projects to facilitate easy deployment of WCF services, loosely modeled on the notion of publishing ASP.NET websites to IIS.  Notice that the WCF Service Library template creates a project that has an app.config – when you hit F5, we spin up our Test Host (think of it like “Cassini for WCF services”), and bring up the Test Client mentioned above.  So the publishing wizard takes a location to publish to, and converts the service from a “self-hosted” service to a Web-hosted service, including taking all the <serviceModel> config information and inserting it into a web.config file.  Here’s a screenshot:

Last but not least, thanks to everyone who tried out the beta and gave us feedback – your efforts help us create a better product and are much appreciated.  Enjoy!


 |  | 
Monday, August 11, 2008 7:46:17 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Monday, May 12, 2008

VS2008 and .NET 3.5 SP1 Enhancements for Service Developers

Today we released the betas for VS2008 sp1 and .NET 3.5 sp1. Scott did a good job (as usual :-)) running through the top-level enhancements, so I won't parrot it all here.. but I'd like to go through the next level of detail on what new goodies we have for service developers.

The most interesting/exciting feature for service developers is what we call Data Services (previously known as "Astoria").  The best way to explain how Data Services fits into the overall "services platform" that .NET provides is through a picture:

As a service developer, .NET offers me a layered stack - if I want to write "to the metal", I can build a service on top of System.Net and HttpListener (which is a managed wrapper on top of HTTP.SYS - our kernel HTTP driver).  Not many people end up doing that, because there are lots of good pieces that we've already written for you..

WCF provides the next layer.  WCF gives you some modular pieces, such as channels (HTTP, TCP, MSMQ, etc); Serialization, which is a fancy word for pouring objects into a serialized formats such as XML, binary, JSON, and deserializing back into objects; and what we call "Syndication", which are some classes that support various data publishing microformats such as RSS and ATOM.  Finally, we have a layer called Service Model that ties all of this stuff together in a coherent, approachable programming model. 

WCF is a powerful but general framework, so the next layer up consists of particular scenarios that we wanted to significantly simplify. I think of two canonical scenarios for writing services: "resource-oriented" services, where you model your service as a bunch of resources and offer request/response, HTTP-based access to those resources; and "operation-oriented" services, where you want to create a new "operation" that wraps a more involved operation that often has to coordinate state changes across multiple resources.

Operation-oriented services become more attractive the more asynchrony you need in your service implementation.. the canonical example is "book a trip" which in turn composes other asynchronous services, such as "book the airfare", "book the hotel", etc.  We realized that most operation-oriented services are actually most easily modeled as workflows.. and that's why we invested heavily in .NET 3.5 in Workflow Services, which is a pretty deep integration between WCF and Workflow.

Resource-oriented services became easier to write in .NET 3.5 via our REST support that we added to WCF.  But we thought we could do even better for some canonical scenarios, such as when you have data in a database (or any LINQ data source) that you want to expose over REST/ATOM.  So the ADO.NET team built Data Services, which is layered on top of WCF's REST and ATOM capabilities and offers a really easy way of doing just that. 

Any layer of abstraction makes some choices, and some of those choices may not be exactly what you want.  The nice thing is that given the layering of Workflow Services and Data Services over WCF, if you don't like the choices we've made for you, you can always drop down to the layer below (WCF). 

As I type this, I realize that there's really one additional scenario that I didn't capture in the picture - which is "services that back a presentation layer".  ASP.NET AJAX is the obvious example of that today.. in .NET 3.5, we added support for being able to "back" an ASP.NET AJAX page with a "AJAX-Enabled WCF Service" (complete with a VS template).  So that's another example of a targetted scenario that's layered on top of WCF... (I'll have to fix my picture :-))

Besides Data Services, there are some additional cool new enhancements in WCF and WF that are worth mentioning:

  • We are enabling DataContract Serializer to serialize types without the need to annotate them with the [DataContract] attribute and its relatives.  We affectionately have taken to calling this feature POCO (plain old C# Objects), tipping our hat to POJO :-)
  • We’ve enabled interoperable object references in our serialization format.  This was done to support certain Entity Data Model (EDM) types but is generally useful in improving our interoperability with Java
  • We’ve made the WCF Test Client (the form that comes up when you hit "F5" on a service) into a stand-alone tool and added more features to increase the breadth of web services it can handle
  • The WCF Service template is now available in the Visual Web Developer Express SKU
  • We are delivering a hosting wizard for Visual Studio WCF Service projects that allows easy deployment of Web Services from VS into IIS
  • Event Logging is now enabled in Partial trust so that people who host their services in medium trust environments have more of the WCF "juice" :-)
  • We extended the syndication OM to support the ServiceDocument in AtomPub
  • We did some nice perf enhancements to the WF activities designer to make it much more snappy, even if you have a large number of activities

And of course, we fixed many of the most common bugs that you all have reported to us (thanks!)

All in all, a bunch of good value in a service pack release.. of course, this is a beta, so there are still some issues in the bits.  Please give them a test-drive and let us know what you think!

 


 |  | 
Monday, May 12, 2008 5:47:49 PM (GMT Standard Time, UTC+00:00)  #  Comments [2] 
 Monday, March 17, 2008

Deploying a Silverlight2 Beta1 Web Project to IIS

SL2 beta1 adds a new packaging format for Silverlight apps - a .xap file.  Silverlight apps work fine in cassini (the ASP.NET development webserver), but trying to deploy the web project to IIS results in a blank page where the silverlight control ought to be.

The issue is that IIS needs to be told about the mapping between the extension and the MIME type.  To fix it, open the IIS MMC, open the MIME Types editor, and add a new entry with the file name extension ".xap" and the MIME Type being "application/x-silverlight-2-b1".  Refresh your page and that should do it...



Monday, March 17, 2008 12:24:19 AM (GMT Standard Time, UTC+00:00)  #  Comments [0]