ASMX Web Service - "This web service uses http://tempuri.org/ as its default namespace." message - but it should not be

I created a web service using Visual Studio (2005 - I know that I am an old school) and it all compiles fine, but when it opens, I get a warning:

This web service does not match the base profile of WS-I v1.1.

And what's more:

This web service uses http://tempuri.org/ as the default namespace.

Which will be fine, except that my service starts this way:

[WebService(Namespace = "http://totally-not-default-uri.com/servicename")] 

Finding the entire solutions folder for "tempuri" returns nothing. I cannot find it mentioned on any configuration page accessible from Visual Studio. And yet it is directly in the wsdl: xmlns: tns attribute definitions on the web service descriptor page when I view it through a browser and as targetNamespace in the same tag. I view it using the debug mode of Visual Studio with an embedded server.

It seems that somewhere somewhere was cached somewhere, but I can’t understand what and where ... I tried to stop and restart the server, clean and rebuild the service and view the associated text files with a text editor, but there is no dice. Any idea what is going on?

+6
c # namespaces web-services asmx visual-studio-2005
source share
2 answers

Um.

After some time, trying to understand this, I returned to the beginning and began to question about my assumptions. Usually in this situation, if someone does not have an answer, I do something really dense.

Of course, I have several classes in the web service file (because it is a stub for testing and will not be used in the long run), and I had a completely wrong class, named in my .asmx file, as code support for the web service.

As soon as I fixed this, everything worked fine.

I'm not proud, this is far from my proud moment, but I will leave it just in case someone encounters the same problem ...

+6
source
  • 1 from me too. I had the same problem, but a slightly different solution: My problem was that, like you, I had several classes in the same .asmx.cs file. I had data classes at the top and below a web service class, and the [WebService (Namespace = "...")] attribute was located at the top of the file above the data classes.

I found 2 solutions: either move the data classes to my own code files (perhaps best), or if you insist on storing several classes in one file, move the BELOW data classes to the web service class or move [WebService (Namespace = "...")] JUST BEFORE attribute of the WebService class.

+2
source

All Articles