314Microsoft Visual Studio 2010: A Beginner’s Guide

Where cst.CustomerID = custID

Select cst).SingleOrDefault()

If Not (customer Is Nothing) Then

ctx.Customers.DeleteOnSubmit(customer)

ctx.SubmitChanges()

End If

End Sub

End Class

The implementation of CustomerService is similar to what you’ve seen in previous chapters. The difference is that the implementation is in a Web service, which must be consumed differently. We’ll soon get to the section of this chapter that shows how to consume a Web service, but you must understand that a Web service is a component that you communicate with over a network. In previous chapters, you’ve seen code that works with data integrated with application code. However, Web services must be hosted by a server, such as Internet Information Services (IIS), and consuming code must connect and communicate through calls to IIS. The next section points you in the right direction about hosting a Web service in IIS.

Hosting a WCF Service

The VS development environment will automatically host your service, but eventually you’ll need to deploy your service to Internet Information Services (IIS), which is the Web server that hosts .NET applications. The instructions included in this section are general guidance on how the deployment process works. It is very likely that subsequent operating system patches and service packs could change the results for you. It is also possible that the particular operating system and IIS configuration on your computer is different. Additionally, the behavior of software on other operating systems, such as Windows Server 2003 and Windows Server 2008, can differ in subtle, but significant, ways. As such problems are unrelated to VS itself, you should consult your operating system documentation on how to properly configure IIS and operating system security. Although operating system behavior is not a function of VS, the guidance below is intended to point you in the right direction.

Page 337
Image 337
Microsoft 9GD00001 manual Hosting a WCF Service