08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

162<br />

CHAPTER 7 ■ .<strong>NET</strong> 3.0: WINDOWS COMMUNICATION FOUNDATION<br />

from these sections to underst<strong>and</strong> the big picture <strong>and</strong> get confident enough for a deep<br />

dive into the technology, should that be what you desire.<br />

To get started building WCF, you’ll first build a new WCF service. Visual Studio 2008<br />

supports these; if you are using Visual Studio 2005 or VWDE 2005, however, note that<br />

you’ll need the .<strong>NET</strong> Framework 3.0 runtime components <strong>and</strong> the .<strong>NET</strong> 3.0 extensions<br />

for Visual Studio (code-named Orcas) before you continue.<br />

Launch your IDE <strong>and</strong> select File ➤ New <strong>Web</strong> Site. The New <strong>Web</strong> Site dialog will<br />

appear (see Figure 7-3). If you are using Visual Studio 2008, remember that you need to<br />

use the .<strong>NET</strong> Framework 3.0 or .<strong>NET</strong> Framework 3.5 filter to be able to see WCF Service<br />

as an option.<br />

Figure 7-3. Creating a new WCF service<br />

Once you’ve selected your service <strong>and</strong> placed it on either the file system or your local<br />

IIS, Visual Studio will create the project files <strong>and</strong> open the editor. You’ll notice a new file<br />

type, with the .svc extension. As you can probably guess, this is a service. The SVC file<br />

structure is a lot like the base ASMX file that we saw earlier. It simply defines the language,<br />

the debug mode, the service class, <strong>and</strong> the location of the code-behind. Here’s an<br />

example:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!