SiteMapPath Stops Displaying in ASP.NET 4

2019-04-14 15:52发布

问题:

We have a SiteMapPath control on the page and this is bound to an XML Web.sitemap file with the default provider. We've had this site for years and have recently upgraded to ASP.NET 4.0 on IIS 7.5 on Windows 2008 R2. For some reason, after about 6-12 hours of operating (not sure exactly when, but it is consistent), the SiteMapPath stops loading for everyone. If we restart the application pool or modify and save the web.config or the web.sitemap XML files, the SiteMapPath starts loading again.

Does anyone have any ideas what could be causing this? There are no file handles keeping the file open that I can see using process explorer.

Thanks,

John

回答1:

We struggled with this for a LONG time, but were eventually able to get Microsoft to figure out what was going on. Short story is MS has addressed it with this hotfix: http://support.microsoft.com/default.aspx?scid=kb;en-US;2472263

In our case, if the first request to the website was from a cookieless device (in our case it was some Russion bot, Yandex), the sitemap would be built with cookiless URLs and cached. Then, any devices that supported cookies would never work because of the way the sitemap was cached with URLs for cookiless sessions. While initial the symptoms were random, we eventually were able to narrow it to an app pool recycle followed by the first request from this bot.

An alternative workaround which works if you want to force cookies is to make this change to the web.config:

<authentication mode="Forms">
     <forms cookieless="UseCookies" />
</authentication>

This forces the sitemap to be built without using cookieless URLs.

Hope this helps!!