Deploying a Web Service

Team-Fly    

Developing XML Web Services and Server Components with Visual C#™ .NET and the .NET Framework, Exam Cram™ 2 (Exam 70-320)
By Amit Kalani, Priti Kalani

Table of Contents
Chapter 11.  Deployment


A Web service can be deployed on a Web server in a variety of ways:

  • By manually copying the files If you have access to the Web server and to the development computer, you can simply copy the project's files to the Web server. You also need to configure the target folder as a virtual directory, set access permissions for the virtual directory, and configure the virtual directory as an IIS application.

  • By using the Project, Copy Project command of Visual Studio .NET Because the Copy Project command can also set the destination directory as an IIS application, it saves an extra step required when manually copying the files using XCOPY or FTP.

  • By using a Windows Installer package created with the Visual Studio .NET Web setup project If you create a Web Setup project that includes the primary output from the Web service project, it installs the Web service on the target computer.

Follow these steps to learn how to create and deploy a simple Web service application:

  1. Open Visual Studio .NET and create a new blank solution named C11 at C:\EC70320. Add a new ASP.NET Web Service project (Example11_1) to the solution.

  2. Rename the Service1.asmx file to Strings.asmx. Switch to Code view and modify the name of the class and its constructor from Service1 to Strings.

  3. Add the following attribute definition before the Strings class declaration:

     [WebService(Namespace="http://techcontent.com/EC70320/C11/Example11_1")] public class Strings : System.Web.Services.WebService 
  4. Enter the following methods in the class definition:

     [WebMethod()] public String ToUpper(String inputString) {    return inputString.ToUpper(); } [WebMethod()] public String ToLower(String inputString) {     return inputString.ToLower(); } 
  5. Set the solution configuration to Release and then build the project to create the Web service.

  6. In the Solution Explorer, right-click the solution node and select Add, New Project. Select Setup and Deployment Projects from the Project Types tree; then select Setup Wizard from the list of templates. Name the project StringsServiceSetup. Click OK. The first screen that appears is the welcome screen; click Next.

  7. The second screen asks you to choose a project type. Select Create a Setup for a Web Application. Then click Next.

  8. The third screen of the wizard enables you to choose the project outputs to include in the setup package. Select Primary Output from Example11_1 and Content Files from Example11_1. Click Finish to end the wizard.

  9. Right-click the StringsServiceSetup project in the Solution Explorer and select View, File System. This opens the File System Editor. Select the Web Application Folder node in the File System Editor and change its VirtualDirectory property to StringsService.

  10. Build the StringsServiceSetup project. Open Windows Explorer and navigate to the project's output folder. Run the setup.exe file. Alternatively, on the development machine, you can install the application by right-clicking the project in the Solution Explorer and selecting the Install option from its context menu. This opens the StringsService Setup Wizard. Accept the default values and complete the installation.

  11. Open Internet Explorer and navigate to http://localhost/StringsService/Strings.asmx. You should now be able to test the Web service.

This setup project works only on the computers on which the .NET Framework runtime has been already installed. For more information on how to redistribute the .NET Framework 1.1 with your application, refer to www.msdn.com/library/en-us/dnnetdep/html/redistdeploy1_1.asp. For more information on how to redistribute the .NET Framework 1.0 with your applications, refer to www.msdn.com/library/en-us/dnnetdep/html/redistdeploy.asp.

You can modify the configuration settings for a Web setup project by selecting the project in Solution Explorer and choosing Project, Properties from the main menu. This opens the project's Property Pages dialog box, shown in Figure 11.2.

Figure 11.2. The Property Pages dialog box displays the configuration properties of the Web setup project.

graphics/11fig02.gif

There are five main configuration properties:

  • Output Filename Specifies the output filename of the installation package (.msi file).

  • Package Files Specifies how to package the files. The options are As Loose Uncompressed Files, In Setup File, and In Cabinet File(s). If the In Cabinet File(s) option is selected, you can also specify the maximum size of the cab files.

  • Bootstrapper Specifies whether a Windows Installer bootstrap file needs to be created for launching the installation program.

  • Compression Specifies whether to optimize the installation files for size or speed, or whether no optimization is required.

  • Authenticode Signature Enables you to specify the file containing the Authenticode certificate, the private key file, and the Timestamp server URL (provided by the Certificate Authority).

graphics/alert_icon.gif

You should use Microsoft Application Center to deploy Web applications and XML Web services to a Web farm or a cluster. For more information on Application Center, see www.microsoft.com/applicationcenter.



    Team-Fly    
    Top


    MCAD Developing XML Web Services and Server Components with Visual C#. NET and the. NET Framework Exam Cram 2 (Exam Cram 70-320)
    Managing Globally with Information Technology
    ISBN: 789728974
    EAN: 2147483647
    Year: 2002
    Pages: 179

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net