An important note for those using Sockets in Silverlight 2.  In beta 1, Sockets were limited to site-of-origin (meaning you could only connect back to the same host that served up the Silverlight application).  This has changed in beta 2 to allow your Silverlight application to connect to any server exposing some Socket connections.

One important note, however, is that a policy implementation has been added.  This policy implementation affects not only cross-domain Socket calls, but site-of-origin ones as well.  So if you are using Sockets, you must have a policy implementation in place.

The policy implementation is done via a similar file mechanism as HTTP-based cross-domain requests.  The policy file looks similar and here is a basic example:

<?xml version="1.0" encoding ="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from>
        <domain uri="file:///" />
      </allow-from>
      <grant-to>
        <socket-resource port="4502-4506" protocol="tcp" />
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
Notice how you can restrict the ports here (note: Sockets in general in Silverlight are limited to ports 4502-4534).

This policy information must be made available on a TCP port request on port 943.  Any Socket request will first look for that policy information to respond on this port 934 request.  If successful, the remaining communication will be allowed.  If not, the communication will fail.

UPDATE: I accidentally typed "934" originally as the port -- it is 943.

There is no code change you need to have in your current Socket implementation other than implementing a Socket policy server to respond to the policy request.  I’ll be covering the basics of sockets on a video over on the Silverlight community site which will demonstrate and provide code on doing this implementation.  Stay tuned for that one.

Hope this helps.

We were all jumping for joy when Silverlight 2 beta 1 was released and the ability to connect to services was more readily/easily available to us.  For discoverable services that provided a WSDL we were quickly able to implement them using the Add Service Reference capability in Visual Studio 2008.  Beta 2 brings a few changes to the world of services that you should know about.  I’ll do my best to recap some of them here.

Generating a WCF Service

In beta 1 when we created a WCF service for use in Silverlight, we used the “WCF Service” template in Visual Studio (assuming you used Visual Studio).  This was fine and created a standard WCF service for us.  There were a few changes that we had to make to ensure that our Silverlight application could consume it in an acceptable manner.  First, we had to change the binding configuration in ASP.NET web.config from wsHttpBinding to basicHttpBinding as Silverlight only supports that binding type right now.  Secondly, we might have had to add capabilities to enable ASP.NET compatibility support depending on what we were doing with the service.  In beta 2, this process gets a bit simpler for services specifically built for Silverlight.  After you install the tools for Visual Studio, you now get a new item type:

It is important to note that the WCF Service template is still a perfectly acceptable one to choose, you just have to ensure to make those changes accordingly.  The new Silverlight-enabled WCF Service basically does those for us as well as add the ASP.NET compatibility attributes for us in the code.  Additionally, the traditional interface/implementation is simplified into a single class.  Again, the other ways are still valid, but for services specifically built for Silverlight, this might be an easier route to get them done.

Cross-domain policy file updates

Cross-domain restrictions still apply within beta 2 and the same rules apply.  There is one subtle change that is required to your clientaccesspolicy.xml file that is required.  In the allow-from node of the policy file, the attribute http-request-headers is now required.  If your service is an open/public one then specifying “*” is probably acceptable (you’ll have to be the judge of that.  If you only wanted to allow specific headers (besides the blacklisted ones) you can provide those in a comma-separated list and can use wildcards as well.  For example you could use X-MyApp-* if you wanted.

Another thing to note about the support for Adobe’s crossdomain.xml policy file is one thing we found in interpretation of the policy template.  Previously Flash was a Macromedia product and as such that file is adorned with a DOCTYPE that represents a schema with macromedia in it.  Well, Adobe has changed the schema a little bit and also updated the DOCTYPE to reflect Adobe as the authority.  Right now, Silverlight still expects to validate the macromedia declaration.

ServiceReferences.ClientConfig

In beta 1, when you performed the Add Service Reference operation a file named ServiceReferences.ClientConfig was created and had some configuration information in it.  This file, however, wasn’t really used.  In beta 2, this configuration file can be shipped with your XAP and used as configuration.  It provides a subset of WCF configuration.  Refined details of those settings are in the SDK, but I thought it might be helpful to know.

Change to WebClient

In beta 1, WebClient was the easiest library to use in accessing non-discoverable services.  One challenge was that it only supported GET verb requests.  In beta 2 WebClient has changed to enable POST verb actions as well.  the UploadStringAsync function will send the request but the endpoint URI must be a URI that accepts the POST verb.

In addition, WebClient is now callable on a background thread in addition to the UI thread.  This may come in handy for some situations.

I see these as small but helpful changes.  Most are based on feedback we received from beta 1 customers and community, so thank you for that feedback.  I hope this helps!

I previously wrote about a known issue with Silverlight Streaming services and videos encoded with Encoder 2.  The quick recap is that a video already encoded to VC-1 using Encoder 2 will not process when using the Manage Videos feature of Silverlight Streaming services.  I provided 3 work around options (#3 being the easiest of those 3) to get you past the issue and get the video uploaded.

The SLS team recently just added another option into the actual process and enables you to use the Manage Videos feature rather than act like uploading an application or renaming files.  When you log into your account (you get 10GB free by the way), click on the Manage Videos option and then choose to upload a video.  You’ll be presented with this screen:

Notice the new option of The video is WMV / VC1-compliant. (It should actually read VC-1 to be picky, but I digress.)  Here’s what you do if your video is already VC-1.  This only applies to this situation…if you still want to use the transcode service, feel free with your AVIs, etc.

First, click that checkbox first.  Do this before you browse the file to set the flag that you will be bypassing the transcode.  Then browse to your file, give it a title and upload.

I hope this helps get around this issue the team identified.  Thanks to the SLS team for implementing a better work around in a short time after the problem was identified.

Well, I have about 3 hours until I leave this little city called Mexico City.  Sarcasm of course, did you know there are roughly 25 million people in Mexico City.  I didn’t.  It is amazing.  Traffic, however, is something to be desired.  I’m told that a 3 mile trip at times could take 1hr, 30 minutes.  Maybe I should stop complaining about my commute when I do it?  No, it still sucks.

Anyway, on to business.  Yesterday I attended and spoke at the MIX Essentials Mexico conference.  These events are happening worldwide and if there is one coming up in your area, you should definitely check it out.  I was fortunate enough to kick off the day with the keynote session talking about building RIAs in Silverlight 2 and demonstrating some of the new capabilities that have been talked about for beta 2.  My second session was on accessing data within Silverlight 2 using web services, RSS/Atom, REST, etc.  I had a great time and hope that the attendees for the day enjoyed the discussions as well.  For myself it was quite interesting as myself and 3 others were the only ones who presented in English.  We had translators (I forgot to tell them thank you as they did a great job) who were doing their best to translate our American and English (UK) slang and language flaws.  Part of me felt a bit disconnected from the audience and it really motivated me to learn Spanish.  I live in Arizona so I’m near the border and we holiday there quite a bit…there is no excuse for me not to start understanding a bit more than “Donde esta el bano?”

I made the mistake of trying to look like I knew what I was doing when in the ride from the airport to the hotel (8 miles, 1hr).  I didn’t know how long it would be and asked the driver “Cuanto tiempo?” which roughly translates to “How long?” and he answered to me about 30 minutes (in Spanish of course, numbers I understand).  I must have had a really good accent, because later he received a phone call, paused, turned around and started saying things I had no idea what he was saying :-) -- we chuckled.

After the keynote, Una Walsh of Conchango did a wonderful presentation talking about *what* user experience is and how it is all around us, not just in technology.  She really knows here stuff and is one of the individuals directing the user experience group at her organization.  Her presentation showed some interesting things that Virgin American has been doing to advertise differently as well as create a unique flight experience that is driving loyalty and enthusiasm.  That’s right, loyalty and enthusiasm in an airline.  They are doing some really unique things to differentiate themselves and at the same time building excitement in a brand in their industry almost to the same level of ‘fanboy’ status.

Rich and FelixNext up was two others from Conchango, Rich Griffin and Felix Corke.  Rich is a developer and Felix a designer.  Together they presented ‘Beauty and the Geek’ discussing the workflow between a developer and a designer.  Both of these guys are really talented and have been working with XAML for a while.  We had some great discussions on what needs to be done to help bridge the gaps further.  I think they were also excited to see some of the things I showed them that is coming.  Rich also talked more in-depth later about XAML.

Una and AlexFresh off a 10 hour plane ride from Argentina, Alex Souza talked about creating web experiences with Expression Studio 2.  This was the first Spanish speaking session.  I sat in for most of this one and Alex really engaged the crowd and although I have no idea what he was saying, I saw a lot of nodding heads.  Alex really knows his stuff and was really confident about the platform.  He demonstrated building an experience using the various tools available to web designers and developers.

Also fresh from Argentina, Gabriel Corvera Ortiz from the Windows Live team, talked about the Windows Live platform.  He said this was the second time he’s been able to do this, but it didn’t show.  This guy is very confident and was able to answer some of the hard questions posed by the attendees.  He’s really smart and I was glad to have met him this weekend.

Arturo Vazquez wrapped up the final session talking about becoming a partner with Microsoft.  I stepped into this one late and although it was in Spanish I could tell there were a lot of questions around what organizations should be doing to get the various levels of partnerships.

It was a really great day and I received a lot of good questions and met some great people.  I had a chance to talk with Alfredo Ceballos and Christian Strevel which were both good conversations about doing fun and interesting things and hopefully soon with Silverlight 2!

For my sessions if you are interested in more, I recommend checking out the Learn section of the Silverlight community site.  Most of what I covered is also available in videos and downloadable code for you to work with.  We’ll be updating this site with examples and content for beta 2 once released so be sure to subscribe to my blog and keep your eyes on the Silverlight site for the best resources!

The event was over and we could all relax a bit.  There were a lot of pictures taken so if you have any be sure to tag them with mixessentialsmx or something like that so we can all see or leave a comment here to the URLs.  You can view my photos on Flickr.

Esamoles

Our gracious hosts for the event (in addition to the agency who helped put everything together…their staff was AWESOME—thank you Rossana and others!) were Eduardo Nava Malagon and Mauricio Angulo.  These guys were the most gracious hosts we could have had.  After the event they took us to Paxia, which was incredible.  The service and food was amazing.  I had a filet with chorizo that was oh so good.  The highlight of the night however was learning all about tequila.  While I don’t drink…the table sure did ;-).  There were many La Loteria being ordered (which essentially is a sampler of 4 fine tequilas).  Felix had to ask about worms, to then the mezcal started coming out.  Mauricio was very much enjoying himself and was so kind to us the entire night.  That was until he decided to let us try some ‘local’ cuisine.  After an exchange with the restaurant host, a plate of guacamole and something else came out (that’s a picture of it here).  Escamoles.  Click the link, then come back.  That’s right…we ate those.  I’ve told myself I’ll try anything once, and I did.  There will probably be no more esacmoles in my future.  You can see a brief video of Felix and Una prepping their tortillas here.

About 15 or 20 la loterias later, we ended dinner and great conversation about culture, language and other things.  I really enjoyed myself in Mexico City (the hotel I was at as well was phenominal, extremely comfortable and would every hotel should be) and am grateful to have been invited.  I hope the attendees to MIX Essentials had fun, learned a little and are excited to create the next great experiences on the web.

Muchas gracias a mis nuevos amigos en la oficina de Microsoft en Mexico City.

Um.  Whoa.

Okay, DevExpress rocks.  I think this will be very well received by the community and you’ll have to watch their page for when it is available and to get your license.

From their site:

As the release of Silverlight draws near, DevExpress has invested the engineering resources needed to deliver a feature-rich grid control for Silverlight. Not just a "preview" of what is possible with Silverlight, the AgDataGrid Suite was developed to fully exploit the power and flexibility of the platform…

It looks like it will support pretty much everything you’d expect in a DataGrid and more…wicked cool.  Congratulations and thank you to DevExpress!!!