Microsoft 9GD00001 Computer Accessories User Manual


 
326 Microsoft Visual Studio 2010: A Beginner’s Guide
Normally, you don’t want to deploy the App_Data folder because it might hold a database
file that is huge and would slow down your application considerably. Of course, if you
have SQL Server Express installed at the deployment location and need the database in
App_Data to be deployed, check this box to include the database in the deployment. Click
Publish to deploy your service.
When deployment is complete, you’ll see a message on the VS status bar stating either
Publish Succeeded or Publish Failed. If publishing fails, open the Output window,
CTRL-W,
O, to see the reason why. There are many reasons a deployment can fail, so look at the
error message to see if it’s something that makes sense to you. Verify that your Web site
is properly set up, as explained in the preceding section. Other sources of information
include the Microsoft Developer Network (MSDN), at http://msdn.microsoft.com, where
you can search for Knowledge Base support articles. Alternatively, you can copy the error
message and paste it into your favorite search engine. Many problems with deployment
surround IIS setup, so it is worthwhile to learn more about how IIS works. McGraw-Hill
offers Windows Server 2008: A Beginner’s Guide, by Marty Matthews (2008), which
does include IIS 7 information. There’s also a Windows Server 2003 edition if you are
deploying to IIS 6.
Now that you know how to develop and deploy a WCF service, you’ll need to know
how to write programs that use that service, which is covered next.
Communicating with a WCF Service
Any .NET application can communicate with a Web service. In fact, one of the benefits of
having a Web service is to expose functionality that can be used by multiple applications.
In theory, any application on any platform can communicate via Web services because the
underlying technology relies on open standards, such as HTTP and XML. In practice, the
goal of cross-platform communication is an advanced technique accomplished by architects
and engineers with detailed knowledge of the inner workings of Web services. For just
getting started, it’s sufficient to know that you can communicate with Web services with any
.NET technology. The following sections show you how to make your applications, clients,
communicate with Web services. Let’s look at the task of generally creating a reference to a
Web service first.
Creating a Service Reference
Regardless of what type of application you’re building, you create a reference to a Web
service, called a service reference, in the same way. You start off with a project, any
project type—Console, WPF, ASP.NET, or Silverlight will do. Right-click the project