WCF Service Publishing

Windows Communication Foundation (WCF) Service Publishing assists you in progressing from the early development environment provided by WCF Service Host and WCF Test Client to actually deploying the application to a production environment for testing purposes. Before you commit to a final deployment plan, you can use Windows Communication Foundation (WCF) Service Publishing to verify that your WCF service performs correctly and is ready to be published. You can also choose to deploy your WCF service libraries to various target locations for testing.

Supported Services and Target Locations

WCF Service Publishing supports publishing WCF services created from the set of WCF service library templates, and their corresponding item templates, which include the following:

  • WCF Service Library template with item template.
  • Sequential Workflow Service Library template with item template.
  • State Machine Workflow Service Library template with item template.
  • Syndication Service Library.

You can find these service templates by choosing File -> New Project -> Visual Basic or Visual C# -> WCF.

The service can be published to the following target locations.

  • Local IIS.
  • File System.
  • FTP Site.
  • Remote Site.

Using WCF Service Publishing

Perform the following steps to deploy a service implementation:

  1. Open a service project, select Build->Publish <Project Name> from the main menu, or right-click the project in Solution Explorer and click Publish.
  2. The Publish window appears. Click the . button to specify the target location that the service should be deployed to. You can select to deploy the application to local IIS, File System, FTP Site, or Remote Site. Specifically, if deploying the application to local IIS, you can also specify additional deployment options.
  3. After you click Publish in the main window, Visual Studio deploys the application to the specified target location and copies the Web.config, .svc, and assembly files to the target directory.

You can use Publish to specify if you want to copy the assembly, configuration, and .svc file for all services defined in the project to the target location, and overwrite existing files at the destination.

Files Generated for Publishing

Before a WCF service library can be Web-hosted, the following files are generated by the tool: assembly files, Web.config file, and .svc file. All the files are copied to the target location. The service is then published.

Assembly files

When you publish a WCF service using this tool, the service is automatically built first and the assembly files are generated in the service project after building.

.SVC File

The publishing operation generates a *.svc file for each WCF service, whether the file exists or not, to ensure version validity. There are two different kinds of svc files: one for WCF Service Library and Syndication Service Library, and another one for Sequential and State Machine Workflow Service Library. The generated *.svc file is copied to the root folder in the target location.

Web.config File

Each time a service project is published to a specific target location, a Web.config file is created.

The generated Web.config file includes Web sections that are useful for Web hosting, and the content of App.config for the WCF service library with the following changes:

  • The base address is excluded.
  • Settings in the <diagnostics> element are excluded to preserve the tracing settings of the target platform.

Security

Publishing to local IIS requires administrator privilege, because IIS requires running in Administrator account. If a user without administrator privilege opens WCF Service Publishing, IIS is not available as a target location. Publishing to File System, FTP Site, or Remote Site works without administrator privilege.

See Also

Concepts

WCF Visual Studio Templates
WCF Service Host (WcfSvcHost.exe)
WCF Test Client (WcfTestClient.exe)

Copyright © 2007 by Microsoft Corporation. All rights reserved.