Deploying web services is similar to deploying web pages, which will be covered in detail in Chapter 19. The .asmx file must be located in a virtual directory exposed by IIS so it is accessible to a browser on the Internet. If you have a .disco file for the web service (described in the previous section), then this file should also be in the application virtual directory. This allows the web service to be discovered and allows proxies to be created by consuming applications. Both of these concepts will be described in the next chapter.

If the application requires a web.config file (described fully in Chapter 18), then this file too should be copied to the application virtual directory.

As with web pages, you can make the compiled class (or classes) and other resources available with either pre-compiled assemblies or with dynamically compiled assemblies.

Pre-Compiled Assemblies

The technique from prior versions of Visual Studio, which is still fully supported, is to compile the source code manually into an assembly file (i.e., the dll) and locate that in the bin directory immediately beneath the virtual directory containing the .asmx file. Manual compilation of assemblies is described in the next chapter and in Chapter 19.

Figure 15-11 shows a typical directory structure on a production web server for a web service called StockTicker.

Typical deployment directory structure

Figure 15-11. Typical deployment directory ...

Get Programming ASP.NET, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.