You can use the statement Debug.WriteLine(“Web Service Debugging”) in your Web method to debug Web service program. However, the debug message “Web Service Debugging” may not be  shown when you run the service from another application project.  Follow the instructions below to fix this problem. 

  1. Make sure that you run the Web service from another project inside the same solution.
  2. Right-click the solution and select the Set StartUp Projects menu. Then the dialog shown in Figure 1 appears.
  3. Check Multiple startup projects and set the Action properties of your projects to be “start“.
  4. Start debugging.
  5. The dialog in Figure 2 may come up. Then click OK to continue.
  6. The debug message should be written in the Immediate or Output Window. If  you cannot see the Immediate Window, click the icon shown in Figure 3 in the tool bar.  

Figure 1:

startup.JPG

 

Figure 2:

debugdialog.JPG

 

Figure 3:

testing.JPG

In Microsoft Visual Studio 2005, port numbers of Visual Web Developer Web Server for tesing your Web service are dynamic by default. This is a problem for another project that creates a Web reference to this Web service. You can set up the Use Dynamic Ports property to false in  the Web service project to fix this problem (see the figure below)fixports.JPG.