Friday, January 23, 2009

I have had some email exchanges with readers lately wanting to know how they can be sure they have the latest version of my Learning WCF book. The original book was printed May 2007, but I did a reprint for VS 2008 last summer which was printed August 2008. I thought it might be useful to post here how you can verify you have the correct text.

If you order a book from Amazon, Barnes and Noble or any other online book vendor you SHOULD be getting the new version of the text printed August 2008. It is difficult to see this clearly on the site because it will still say "Printed May 2007". The way to be sure is to view the print history page of the book and look for the ever so obscure [08/08] in the bottom right corner of this page. Here is a screen shot of the page with relevant sections at the top/middle/bottom showing. I was finally educated on these details of the printing process by O'Reilly so that I could help explain this to my readers...whew! Apparently only when there is a rewrite (as opposed to a reprint with minor changes) do they, and the bookstore, update the Printing History section both in the book and on the web sites.

image

If you are reading the book online at this site: http://my.safaribooksonline.com/9780596101626, you will always get the correct version of the book of course.

NOTE: For those who have the original text and are not planning to buy a new copy, remember that I posted the updates to Chapter 1 of Learning WCF here on my blog with O'Reilly's permission. Basically Chapter 1 was significantly changed for the labs, and some of the content was updated as well. That's because Orcas tools for VS 2005 were different than the released version in VS 2008. Mostly the changes help you with labs, and update instructions to refer to the new version of VS. The remainder of the book's labs have a set of startup files that I updated to work with VS 2008, thus, the Orcas/VS 2008 templates are not heavily used if at all. I did not have to update much else throughout the book.

1/23/2009 1:08 PM  | Comments [4]  |  View reactions  |  Trackback
 Sunday, November 16, 2008

My book has recently gone through a reprint and for this I have updated the lab instructions and relevant text to reflect changes from the Orcas CTP that was available for Visual Studio 2005 to the Orcas tools released with Visual Studio 2008. The only chapter with any significant changes is Chapter 1. In fact, I barely had to update other chapters. So, O'Reilly has agreed to let me post the updated Chapter 1 here.

http://www.thatindigogirl.com/downloads/LearningWCFChapter01VS2008.pdf

Last year I updated the labs and code samples for Visual Studio 2008, but I have posted an update to that link with the final changes associated with the book reprint. 

http://www.thatindigogirl.com/downloads/LearningWCFVS2008.zip

Don't forget to review Appendix A for setup instructions related to database, certificates and other security settings.

http://www.thatindigogirl.com/downloads/AppendixA-Setup.pdf

11/16/2008 10:22 AM  | Comments [11]  |  View reactions  |  Trackback
 Monday, October 13, 2008

Almost one year ago, I was teaching our WCF Master Class in Norway and one of my students, Lars Wilhelmsen, began extending the WCF Test Client so that it could save and load test settings, for example. He had it working that week, but just now officially posted a blog with the polished version of his extension here: http://larswilhelmsen.com/2008/10/04/wcf-test-client-extended/

I'm not a big fan of the test client for a proper test effort, but Lars extension makes this tool a more viable option for casual testing. It is worth a look!

Regards from Oslo, Norway today. Brrrr.....

10/13/2008 8:20 PM  | Comments [2]  |  View reactions  |  Trackback
 Wednesday, November 14, 2007

I have updated all the code samples for the book to work with Visual Studio 2008. The projects have been converted to .NET 3.0 projects. Since I took this from a working directory I use for demos, please let me know if you find anything doesn't work as it should, or if you have questions. Thanks!

http://www.thatindigogirl.com/downloads/LearningWCFVS2008.zip

I also updated the main blog entry for all the code samples for the book here:

http://www.thatindigogirl.com/LearningWCFCode.aspx

Technorati Tags: , ,
11/14/2007 2:54 AM Code  | Comments [39]  |  View reactions  |  Trackback
 Saturday, November 10, 2007

If you are using VS 2008 (Beta 2) there are changes to the tools that affect this lab in Chapter 1. Here are a summary of changes for each step that is affected in the lab starting on Page 32 of Learning WCF.

Section 1: Using the WCF Service template

  • Step 3: Open IHelloIndigoService.cs instead of HelloIndigoService.cs.
  • Step 4: Open HelloIndigoService.cs to modify the class.
  • Step 5 + 6: VS 2008 does not create a MyServiceHost helper class so you will have to host the service yourself as you did in the previous lab by adding the following code to the Program.cs file:
using System.ServiceModel;

static void Main(string[] args)

{
  using (ServiceHost host = new ServiceHost(typeof(Host.HelloIndigoService)))
  {
     host.Open();
     Console.WriteLine("Press <Enter> to terminate the service host.");
     Console.ReadLine();
   }
}
  • Step 7: Before you compile and run the Host project, delete the <system.serviceModel> section from the App.Config so that you can create a new configuration section from scratch in the next section, instead of using what was generated for you already. In VS 2008, the WCF Service template already created an endpoint configuration for the service in the App.config. The new configuration should look like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>

Section 2: Configuring service endpoints using the Service Configuration Editor

  • Step 1: In VS 2008 (Beta 2) to open the WCF Service Configuration Editor you have to go to the Tools -> WCF SvcConfigEditor menu item. Then you have to open the App.config file by browsing to it in the file open dialog. Select File->Open->Config File and browse from there. Hopefully they will bring back the context menu in the final release of VS 2008.
  • Step 8: In VS 2008 (Beta 2) when you run the Host project in Debug mode you can't add a service reference to the client. So, run the Host project without debugging in this step to avoid this problem. Hopefully this will be fixed before release.

Section 3: Generating a proxy with Add Service Reference

  • Step 1: Name the service reference "localhost" to match the other steps in this lab. VS 2008 names services references "ServiceReference" instead. Click Go to find the metadata for the service, then click OK to add the service reference. In VS 2008 the hierarchy of the generated metadata files is slightly different, and location of the service metadata is in Reference.cs not localhost.cs.

Section 4: Creating a WCF Service Library

  • Step 1: In VS 2008 (Beta 2) you'll find the WCF Service Library template under the WCF category of templates. Do not choose WCF Service Application from the main set of templates.
  • Step 2: Rename IService1.cs to IHelloIndigoService.cs, and Service1.cs to HelloIndigoService.cs.
  • Step 3: Open IHelloIndigoService.cs to modify the contract.
  • Step 4: Open HelloIndigoService.cs to modify the class. Delete all the extra code created for you.
  • Step 7: Open Program.cs to modify the ServiceHost type.
Technorati Tags: ,
 Friday, September 7, 2007

I have officially completed a 15-part webcast series on WCF. You can reply each recording by clicking on the links provided in this post:

http://www.dasblonde.net/WCFWebcastSeries.aspx

I have also some extensibility examples here:

http://www.thatindigogirl.com/WCFExtensibility.aspx

Samples for the webcast are almost exclusively from my book code, which you can access here:

http://www.thatindigogirl.com/LearningWCFCode.aspx

Enjoy!

9/7/2007 6:55 PM  | Comments [13]  |  View reactions  |  Trackback

The Windows SDK provides many WCF extensibility samples. I also have some samples recently presented in a webcast. You can get the samples here.

9/7/2007 6:53 PM  | Comments [3]  |  View reactions  |  Trackback
 Wednesday, August 22, 2007

I have been receiving some questions related to the VS 2008 (Beta 2) projects available, and how they compare to the Orcas plug-in to VS 2005 for building WCF projects. I just made a series of posts on the various project templates and how they compare to VS 2005 with the Orcas extensions for WCF. This should help you with the labs in this book, Learning WCF.

Here is a list of posts on the subject:

 

Technorati Tags: ,
8/22/2007 7:50 PM Labs (General)  | Comments [3]  |  View reactions  |  Trackback

Template comparison:

  • VS 2005 + Orcas extensions: WCF Service (new item)
  • VS 2008: WCF Service (new item)

The new template in VS 2008 has not changed much. The main difference is the naming convention of project files generated, the separation of service contract and service type files, and the sample service contract and service type code is slightly different.

Impact to Learning WCF labs:

Anywhere I ask you to add a new WCF Service to a project you should continue with the same instructions. The difference will be in the files generated.

  • When I ask you to modify the names of the service file I usually have you use the service name, for example, HelloIndigoService.cs. Now, you will rename the service contract source file to use an "I" prefix (for example, IHelloIndigoService.cs) and rename the service type source file to my original recommendation (for example, HelloIndigoService.cs).
  • When I ask you to modify code for the service contract or service type, you can modify them in their respective source files. There is no need to merge the two into one file.

Summary of WCF Service new item template in VS 2008:

In any project, you can add a new WCF Service item to the project as shown here:

addwcfservice

This adds a new service contract and service type to the project, in separate files.

Technorati Tags: ,
8/22/2007 7:46 PM Labs (General)  | Comments [3]  |  View reactions  |  Trackback

Template comparison:

  • VS 2005 + Orcas extensions: WCF Service (from New Web Site, file-based)
  • VS 2008: WCF Service Application

This is a new template in VS 2008, but it compares roughly to the new web site WCF Service template if you use file-based web sites. I describe the details and differences below.

Impact to Learning WCF labs:

I don't recommend you use this template for the labs. I instruct you to use the new web site, file-based, WCF Service template where appropriate. This template will confuse you with the labs, and frankly, I don't think this template is very useful.

Summary of the new WCF Service Application template in VS 2008:

There is a new template for WCF services in VS 2008, the WCF Service Application. This new template produces similar results to the file-based web site using the WCF Service template (see my earlier post). The main difference is in the organization of the project files, whish is less ASP.NET and more assembly style. For this reason, I don't think it is valuable. For one, I never put my service code in the host project so the organization of service files outside of the .svc endpoint becomes irrelevant. Furthermore if I am hosting in a web site, I would rather use the familiar ASP.NET project layout than learn a new structure...I think this will confuse developers. I recommend you don't use this template and if you are hosting in IIS or want to use file-based because IIS is not on the machine...use the web site templates.

Having said that, I will still describe the template here.

You start by creating a project using the WCF Service Application template shown here:

wcfserviceapp

And the generated project files include a samples service contract, service, .svc endpoint and web.config with appropriate <system.serviceModel> settings.

wcfserviceappprojectfiles

A few things to note about this include:

  • Unlike when you explicitly generate a new file-based web site, the code for the service is not placed in the App_Code directory. We don't really care, because you'll end up deleting the service files (IService1.cs and Service1.svc.cs) because your services should not be coupled to the host. You'll instead map the .svc endpoint to another service defined in another assembly.
  • Note the separation of files: IService1.cs contains the service contract, Service1.svc is our traditional service endpoint for web hosting (Cassini, IIS or WAS), and the code associated with the .svc file is Service1.svc.cs - just like the familiar code associated with ASP.NET web pages.

To modify the .svc code you have to view the .svc in markup by right-clicking on the View Markup context menu (yet another strange thing about this template...with web site templates you just double-click the .svc file and it opens):

viewmarkup

Then you can modify the code from this:

<%@ ServiceHost Language="C#" Debug="true" Service="WCFServiceApp.Service1" CodeBehind="Service1.svc.cs" %>

To something like this (assuming you reference the HelloIndigo assembly, which has a HelloIndigoService type in it):

<%@ ServiceHost Service="HelloIndigo.HelloIndigoService"  %>

 

Technorati Tags: ,
8/22/2007 7:43 PM Labs (General)  | Comments [2]  |  View reactions  |  Trackback

Template comparison:

  • VS 2005 + Orcas extensions: WCF Service (from New Web Site)
  • VS 2008: WCF Service (from New Web Site)

The new template for WCF Service when generating a new web site in VS 2008 has not changed much. The main difference is the naming convention of project files generated, the separation of service contract and service type files, and the sample service contract and service type code is slightly different.

Impact to Learning WCF labs:

Anywhere I ask you to create a new web site using the WCF Service, you should continue to do so. The difference will be in the file location where the service contract and service type is located.

  • When I ask you to modify the name of the .svc file, or modify the @ServiceHost directive, nothing changes - follow the instructions as written.
  • When I ask you to delete the generated service contract and service type, you will now have two files to delete instead of just one, in the App_Code directory. 

Summary of WCF Service web sites in VS 2008:

When you want to host a WCF service in IIS you will turn to the web site templates for WCF. In VS 2008, the same web site template exists for WCF services - the WCF Service template. The following dialog shows creating a file-based web site using this template:

wcfservicefilebasedwebsite

I recommend using this template in the following scenarios:

  • When you are not able to run IIS on the machine. Some corporate environments have this limitation on developer machines. Personally, I think this is a mistake because it also means developers can't test real security behaviors (as in the identities that must be configured so that services can talk to database, etc.)
  • When you are not testing security and just want a simple solution you can distribute. For example, when I build code samples it makes them easier to distribute I usually use file-based web sites. That saves you the trouble of creating a virtual application in IIS to run the sample, and generally makes them easier to distribute to folks if they have IIS or not. I can't do this for samples the work with certain security settings in the bindings, however.

You can also create web sites in IIS selecting this template:

wcfserviceiiswebsite

The end result is the same as you expect with Orcas extensions in VS 2005. The project includes a .svc endpoint with a sample service contract and service in the App_Code directory. The main difference is that now the contract and service are separated into different files (IService.cs and Service.cs):

wcfservicewebsiteprojectfiles

Technorati Tags: ,
8/22/2007 7:36 PM Labs (General)  | Comments [2]  |  View reactions  |  Trackback

Template comparison:

  • VS 2005 + Orcas extensions: WCF Service Library
  • VS 2008: WCF Service Library

The new template in VS 2008 has not changed much. The main difference is the naming convention of project files generated, the separation of service contract and service type files, and the sample service contract and service type code is slightly different.

Impact to Learning WCF labs:

Anywhere I ask you to create a WCF Service Library, you should follow the same steps. The difference will be in the file location where the service contract and service type is located.

  • When I ask you to modify the names of the service file I usually have you use the service name, for example, HelloIndigoService.cs. Now, you will rename the service contract source file to use an "I" prefix (for example, IHelloIndigoService.cs) and rename the service type source file to my original recommendation (for example, HelloIndigoService.cs).
  • When I ask you to modify code for the service contract or service type, you can modify them in their respective source files. There is no need to merge the two into one file.

Summary of WCF Service Library in VS 2008:

The most likely scenario for creating a new WCF service is to create a new WCF Service Library. That is, a class library assembly with a service contract and service type within. Select the template as shown here:

wcfservicelib

It generates the same result as VS 2005 with Orcas extensions, except that the service contract and service type are in separate files (IService1.cs and Service1.cs):

wcfservicelibfiles

Technorati Tags: ,
8/22/2007 7:30 PM Labs (General)  | Comments [2]  |  View reactions  |  Trackback
 Thursday, August 16, 2007

Today I completed a webcast as part of a 15 part series - today's subject concurrency, throughput and throttling. I received some questions about callback and Windows client applications that I thought I would elaborate on on my main blog. The post discusses the behavior of services and clients when you have a Windows client, a service with a callback contract (thus, two-way communication) and various WCF settings at the client and service that relate to concurrency, multithreading, synchronization with the UI thread, and so on.

You can get to the post here.

Technorati Tags: , ,
    About the Book
    ON THIS PAGE
    CATEGORIES
    ARCHIVES
    DASBLONDE

Designed by NUKEATION STUDIOS