11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

amrameshreddy.blog.com122 CHAPTER 4 ■ INSTALLING AND CREATING WCF SERVICESramrameshreddy.blog.comThis implementation follows the best practice of separating the contract definitionfrom the implementation. In the example, the ServiceContract attribute is applied to theITradeService interface. Additionally, the single method signature within ITradeService hasthe OperationContract attribute. These attributes signal to the WCF runtime how to generatethe metadata and WSDL necessary for discovering supported operations in addition to managingthe actual runtime calls from clients.The TradeService class simply implements ITradeService. How does the WCF runtimeknow what type to load in response to client requests? You’ll see in a little bit how it takes placethrough configuration, specifically, how the ABCs are tied together.Make sure it compiles before proceeding. If there are no errors, create a simple ASP.NEThosting project for this newly created .NET 3.0/WCF service library.In Solution Explorer, add a new empty website—which is just a standard ASP.NET websiteto your solution. Do this either by right-clicking the solution and choosing Add New Web Siteor by choosing File ➤ Add ➤ New Web Site from the Visual Studio menu.Now, select the web project you just created in Solution Explorer, right-click, and chooseto add a reference. Once the Add Reference dialog box opens, select the Projects tab, andchoose the Exchange Service project from the list.Now, right-click the project again, and add a Web.config (web configuration) file to theproject if one does not already exist. Modify the contents of the Web.config file, ensuring the section appears as a child to the element, as shownin Listing 4-9.Listing 4-9. Website Web.config File (Partial)...ramrameshreddyramrameshreddy

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

Saved successfully!

Ooh no, something went wrong!