ASMX Web 服务 - “此 Web 服务使用 http://tempuri.org/ 作为其默认命名空间。”消息 - 但它不应该是

发布于 2024-09-02 22:35:02 字数 735 浏览 1 评论 0原文

我已经使用 Visual Studio 创建了一个 Web 服务(2005 年 - 我知道我很守旧),一切都编译得很好,但当它打开时,我收到警告:

此 Web 服务不符合 WS-I Basic Profile v1.1。

而且:

此 Web 服务使用 http://tempuri.org/ 作为其默认命名空间。

这很好,除非我的服务是这样开始的:

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

在整个解决方案文件夹中搜索“tempuri”不会返回任何结果。我在 Visual Studio 可访问的任何配置页面中都找不到提及它。然而,当我通过浏览器查看它并作为同一标记中的 targetNamespace 时,它​​就位于 Web 服务描述符页面上 xmlns:tns 属性的 wsdl:definitions 列表中。我正在使用 Visual Studio 的“调试”模式以及内置服务器来查看它。

似乎有些东西已经缓存在某个地方,但我无法弄清楚是什么和在哪里 - 我尝试停止并重新启动服务器,清理和重建服务,并使用文本编辑器浏览相关的文本配置文件,但没有骰子。知道发生了什么事吗?

I've created a web service using Visual Studio ( 2005 - I know I'm old school ) and it all compiles fine but when it opens I get warned thus:

This web service does not conform to WS-I Basic Profile v1.1.

And furthermore:

This web service is using http://tempuri.org/ as its default namespace.

Which would be fine except my service begins thus:

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

Searching the entire solution folder for "tempuri" returns nothing. I can't find it mentioned in any configuration page acessible from Visual Studio. And yet it's right there in the wsdl:definitions list for the xmlns:tns attribute on the web service descriptor page when I view it through the browser and as targetNamespace in the same tag. I'm viewing it using Visual Studio's "debug" mode with the built in server from that.

Seems like something has got cached somewhere but I can't work out what and where- I've tried stopping and restarting the server, cleaning and rebuilding the service and going through the associated text config files with a text editor but no dice. Any idea what is going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

单挑你×的.吻 2024-09-09 22:35:02

咳咳。

经过一段时间试图弄清楚这个问题后,我又回到了起点,开始质疑我的假设。通常在这种情况下,如果似乎没有人有答案,我就会做一些非常密集的事情。

果然,我的 Web 服务文件中有几个类(因为它是用于测试的存根,不会长期使用),并且我在 .asmx 文件中命名的类完全错误,作为支持代码网络服务。

一旦我纠正了这个问题,一切就都正常了。

我并不自豪,这远不是我最自豪的时刻,但我会留下这个,以防其他人遇到同样的问题......

Ahem.

After a while trying to figure this one out, I got right back to the start and began questioning my assumptions. Usually in this kind of situation if nobody seems to have an answer I am doing something really dense.

Sure enough, I have a couple of classes in my Web Service file ( because it's a stub for testing and will not be used in the long term ) and I had completely the wrong class named in my .asmx file as the supporting code for the web service.

Once I corrected that, everything worked fine.

I'm not proud, it's far from my proudest moment, but I'll leave this just in case anyone else runs into the same problem...

生生不灭 2024-09-09 22:35:02
  • 1 也来自我。我有同样的问题,但解决方案略有不同:我的问题是因为,像你一样,我在同一个 .asmx.cs 文件中有多个类。我的数据类位于顶部,Web 服务类位于其下方,[WebService(Namespace = "...")] 属性位于文件顶部,数据类上方。

我找到了 2 个解决方案:要么将数据类移动到它们自己的代码文件中(可能是最好的),或者如果您坚持将多个类保留在同一个文件中,请将数据类移动到 Web 服务类下方,或者移动 [WebService(Namespace) = "...")] 属性位于 WebService 类之前。

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

I found 2 solutions: either move the data classes to their own code files (probably best), or if you insist upon keeping multiple classes in the same file, move the data classes BELOW the web service class, or move the [WebService(Namespace = "...")] attribute to JUST BEFORE the WebService class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文