Home > Articles > Programming > C#

  • Print
  • + Share This
From the author of

From the author of

Deploying the Web Service

When the logic is done, the Web service must be configured and deployed. Visual Studio.NET does this automatically when the Web service is created. It also adds other files to the project that assist deployment: web.config and InvestmentService.vsdisco. The web.config file has various configuration settings for ASP.NET to work with the web service. A .vsdisco file is part of the discovery service that helps people find your Web service through Internet Information Server (IIS). For a simple application like this, Visual Studio.NET will take care of deploying your application.

NOTE

The beta versions of Visual Studio.NET have a bug that causes a compilation error when trying to deploy a brand-new Web service. The workaround is to delete all the files in the project and then add a brand-new Web service to the empty project (right-click on the project name and then select Add, Add Web Service). Then use the same process to add web.config and .vsdisco files. Their contents will be generated automatically. Make sure that you name the .vsdisco file InvestmentService.vsdisco. Later builds should correct this bug, making the procedure in this note unnecessary.

After the Web service is deployed, a program can use it. On a separate project, based on the InvestmentForm and InvestmentController classes, the client project, you can create a reference to the Web service (right-click on the project and select Add Web Reference). When you first created the InvestmentService Web service, you specified the IIS directory, where it would reside. Fill in the address at the top of the Add Web Reference dialog box with the same directory path as the InvestmentService Web service, and reference the InvestmentService.vsdisco file. For example, my Web service discovery file is located at http://localhost/InformIT/InvestmentService/InvestmentService.vsdisco.

What you'll get is a new subfolder under the Web References folder in the client project with subentries that help the application find the Web service. The name of the subfolder will be localhost. You should change that to InvestmentService, which identifies the namespace from which to reference the Web service.

  • + Share This
  • 🔖 Save To Your Account