|
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: WCF, VS 2008
|