WCF Services—Hello World


Jump to: navigation, search
Visual C# Tutorials
.NET Framework Tutorials

WCF Services

© 2007 Chris Peiris, Dennis Mulder

Programming Model

Now, you’ll see the simplest of examples (Chapter04/Example01 in the downloadable code) in both ASP.NET 2.0 and WCF. This first sample is just to provide a minimal example of a service implementation. The example uses a "code first with attributes" model. To be clear, this is not a best practice—it’s purely an example to show the similarities between ASP.NET 2.0 web services and WCF. The best practice is a contract-first model where you define the schema prior to coding the implementation. This removes the designer’s bias toward any implementation details or restrictions.


Note With some of the IIS-hosted samples, a set of scripts provides the IIS virtual directory creation and ASP.NET mapping, along with a script to remove the IIS virtual directory when done. The creation/removal scripts are in each example’s directory and are named CreateVirtualDirs.bat and DeleteVirtualDirs.bat, respectively. You must be an administrator on the system from where these files are executed. Additionally, if you’re on Vista, you must run from an elevated command prompt from the directory where these files exist.


Also, to ensure you focus on how the services are created, we will use only IIS as the hosting environment.


Previous_Page_.gif Next_Page_.gif

Share this page
  • del.icio.us
  • Facebook
  • Google+
  • StumbleUpon