访问 Lists.asmx Web 服务时出现 MOSS 2007 404 错误

发布于 2024-09-29 23:31:44 字数 1057 浏览 4 评论 0原文

目前我有一个 ASP.net 4.0 应用程序,其中我对 MOSS 2007 服务器进行了 Web 引用。当我从根应用程序访问任何lists.asmx方法时,一切正常。但是,如果我尝试将 C# 代码隐藏中的服务 URL 更改为子文件夹 list.asmx 的服务 URL,然后访问 any 方法,则会收到 404 错误。但真正奇怪的是,如果我将已更改的 URL 手动插入 IE 并运行它,该服务会正常加载(按预期提供所有可用方法的列表。)

这是我的概要我正在使用的代码:

这有效:

 ListsService.Lists m_listService = 
 ICredentials m_credentials = CredentialCache.DefaultCredentials;
 m_listService.Credentials = m_credentials;
 // No change to URL, defaults to 'http://mosstest/SiteDirectory/RootApp/SubApp/_vti_bin/lists.asmx'
 XmlNode listColl = m_listService.GetListCollection();  // Works fine, gives me collection of lists in the root folder.

这不起作用:

 ListsService.Lists m_listService = 
 ICredentials m_credentials = CredentialCache.DefaultCredentials;
 m_listService.Credentials = m_credentials;
 m_listService.Url = "http://mosstest/SiteDirectory/RootApp/SubApp/Subfolder1/_vti_bin/lists.asmx";
 XmlNode listColl = m_listService.GetListCollection();  // Throws a 404 Not found error.

还有其他人遇到类似的事情吗?

Currently I have an ASP.net 4.0 app in which I've made a web reference to an MOSS 2007 server. When I access any lists.asmx methods from the root application, everything works fine. However, if I try to change the service URL in C# code-behind to that of a subfolders list.asmx, then access the any method, I get a 404 error. The really strange thing though is if I take the URL that I've changed it to and plug it manually into IE and run it, the service loads fine (giving me a list of any methods available as expected.)

Here's a rundown of my code that I'm using:

This works:

 ListsService.Lists m_listService = 
 ICredentials m_credentials = CredentialCache.DefaultCredentials;
 m_listService.Credentials = m_credentials;
 // No change to URL, defaults to 'http://mosstest/SiteDirectory/RootApp/SubApp/_vti_bin/lists.asmx'
 XmlNode listColl = m_listService.GetListCollection();  // Works fine, gives me collection of lists in the root folder.

This doesn't work:

 ListsService.Lists m_listService = 
 ICredentials m_credentials = CredentialCache.DefaultCredentials;
 m_listService.Credentials = m_credentials;
 m_listService.Url = "http://mosstest/SiteDirectory/RootApp/SubApp/Subfolder1/_vti_bin/lists.asmx";
 XmlNode listColl = m_listService.GetListCollection();  // Throws a 404 Not found error.

Anyone else run into something similar?

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

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

发布评论

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

评论(1

乄_柒ぐ汐 2024-10-06 23:31:44

事实证明,我试图访问列表本身,而列表本身并不是一个应用程序。我正在头头学习这个。不过我要注意的是,无论 URL 如何,通过浏览器访问时 SP 似乎都不会给出 404 错误。如果我输入类似“http://mosstest/SiteDirectory/RootApp/SubApp/Subfolder1/_vti_bin/lists.asmx”的内容,而 SubFolder1 不存在,它仍然会提供“可用”方法列表,并像服务一样运行确实在那里。不知道为什么它会这样做,但它确实引起了很大的混乱。

Turns out I was trying to access a List itself, which in turn was not an application. I'm learning this headfirst. I will note however that SP seems to not give a 404 error when accessing via the browser, regardless of the URL. If I type in something like "http://mosstest/SiteDirectory/RootApp/SubApp/Subfolder1/_vti_bin/lists.asmx", with SubFolder1 not existing, it still gives a list of methods "available" and runs as if a service was indeed there. Not sure why it does this, but it does cause a great deal of confusion.

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