Rants, rambles, news and notes from another geek

Namespaces in .NET Web Services

I always forget about these. When you add a new Web Service to your ASP.NET project (I’m assuming you use VS.NET), it uses the default namespace http://tempuri.org/. This is just fine as long as two conditions hold:

  1. You don’t plan on deploying your Web Service
  2. You only have one Web Service in your project

Because I keep forgetting this, I always end up fighting&nbsp_place_holder;my Web References.&nbsp_place_holder;ALl of my WDSL files show up, but when you try to reference another&nbsp_place_holder;Web Service, you get a compile error ‘cause it only sees one URI! So remember to always define a unique URI for each of your&nbsp_place_holder;Web Services as follows:

public class Items : System.Web.Services.WebService  
&nbsp_place_holder;&nbsp_place_holder; // blah blah  

The other Web Service thing that I forget is how to re-enable the .vsdisco file so that you can reference all of the Web Services in one ASP.NET project. To do this, add the following to your web.config file in the system.web section:

 <add verb="*" path="*.vsdisco"   
 System.Web.Services, Version=1.0.3300.0,   
 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"   

[Update] I wrapped that to fit in the page, but in my web.config I keep the entire element on one line.