站点地图文件可能包含在 .net 解决方案中的替代位置

发布于 2024-10-21 03:35:45 字数 866 浏览 5 评论 0原文

我从一位不再可用的同事那里接管了一个相当大的 C# .NET 2.0 遗留 Web 应用程序。该 Web 应用程序由一个解决方案中的多个项目组成。我遇到了一个我根本不理解的问题,希望这里有人能理解。

该应用程序的站点地图子文件夹中包含多个 .sitemap 文件。到目前为止,一切都很好。但我发现一个 .sitemap 文件漂浮在 Web 项目的根目录中,并且不在应用程序中的任何位置使用(它不包含在 web.config 中)。

我排除了这个文件。没有它,Web 应用程序运行良好。所有菜单均正确加载。直到我找到一种使用递归来查找某些控件(不是站点地图!)的方法。此方法从给定点开始遍历所有控件,然后由于 XMLSitemapProvider 缺少这个文件而崩溃。此方法被调用多次,不会出现问题,但当用户注销时,它会以某种方式运行控件的分层路径,最终到达丢失的 .sitemap 文件。

该文件还需要位于根目录中的这个确切位置。将其移到其他地方会导致同样的崩溃。

XmlSiteMapProvider 所需的文件 web.sitemap 不存在。

我已搜索该文件名和所有“.sitemap”文件,但在解决方案中找不到它。找到 0 个结果。我已经运行了导致崩溃的所有代码,它似乎是任意的(它与站点地图无关)。崩溃的发生是因为它在遍历所有控件时遇到了寻找另一个控件的 XmlSiteMapProvider。简而言之,我找不到该文件的任何参考资料!

由于这个网络应用程序非常庞大,我无法手动浏览每一部分代码。有数十万行代码。有谁知道通过 web.config 包含站点地图或如何注册站点地图文件以及我应该在哪里查看的任何其他方式?

最后说明:此应用程序使用了本地化。站点地图已本地化,我找到了该站点地图的资源。我希望排除这些可以解决问题。不幸的是没有。

I took over a rather large C# .NET 2.0 legacy web application from a colleague who is no longer available. This web application consists out of multiple projects in one solution. And I ran into a problem that I simply do not understand and hopefully somebody here will.

The application has multiple .sitemap files included in a sitemap subfolder. So far so good. But I found one .sitemap file that was floating around in the root of the web project and is not used anywhere in the application (it's not included in the web.config).

I excluded this file. The web application runs fine without it. All menu's load correctly. Until I hit a method that uses recursion to look for certain controls (NOT the sitemap!). This method runs down through all controls from a given point and then crashes on the fact that the XMLSitemapProvider is missing this one file. This method is called many times without issues, but when the user logs out it somehow runs through a hierachical path of controls that eventually end up at the missing .sitemap file.

The file also needs to be at this exact location in the root. Moving it somewhere else will cause the same crash.

The file web.sitemap required by XmlSiteMapProvider does not exist.

I have searched for this filename and all ".sitemap" files but can not find it anywhere in the solution. 0 results found. I've ran past all the code leading up to the crash and it seems arbitrary (it has nothing to do with the sitemaps). The crash just happens because it hits the XmlSiteMapProvider looking for another control when it's going through all controls. In short, I can find no references what so ever to this file!

Since this web application is huge I can not manually go past every section of code. There is hundreds of thousands of lines of code. Does anybody know any other way then through the web.config to include a sitemap or how a sitemap file could be registered and where I should look?

Final note: this application used localization. The sitemap's are localized and I found resources for this one sitemap. I hoped excluding those would solve the problem. Unfortunately it didn't.

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

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

发布评论

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

评论(2

东北女汉子 2024-10-28 03:35:45

据我了解,您刚刚排除了根站点地图。请查看以下链接: http://msdn.microsoft.com/en -us/library/yy2ykkab.aspx
那里说:

Web.sitemap 文件必须位于应用程序根目录

As far as I understand it, you just excluded your root sitemap. Have a look at the following link: http://msdn.microsoft.com/en-us/library/yy2ykkab.aspx.
There it says:

The Web.sitemap file must be located in the application root directory

蓝颜夕 2024-10-28 03:35:45

答案是,当您未在 webconfig 中设置默认值时,它会查找此文件名。在您的 webconfig 中将默认值设置为实际定义的站点地图,问题就消失了......

The answer is that when you do not set a default in your webconfig it will look for this filename. Set a default to an actually defined sitemap in your webconfig and the problem goes away...

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