Thursday, August 16, 2007

Debugging Web Services on Your Local Machine

Scenario: Visual Studio 2005, one solution, two projects; one project is your Web Service project, the other your client. IIS is not on your client.
  • Clicking "Properties" of the Web Services project, click the "Web" tab. Change the entry under "Use Visual Studio Development Server" from "Auto-assign Port" to "Specific port".
  • Clicking "Set Startup Projects" of the solution, change the entry from "Current selection" to "Multiple startup projects." Change the Action from "None" to "Start."
  • Make sure your client project is set up as the Startup Project.
  • If you haven't already, add the Web Reference in your client project, choosing "Web Services in this solution."
  • Make sure that your dependencies are set so that your client project is dependent upon your Web Services project.
Now when you debug, each time you press F5 you will start up the Cassini web server at the port you hard coded in Step 1; then your client project will run and connect to the service. Terminating the debugging session will terminate both your client and the Web Services projects.

This could eliminate your getting the "System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it" exception in the Reference.cs file.

2 comments:

Anonymous said...

This was good advice. Very helpful.

Anonymous said...

Thanks for posting this.