.NET 4.0 上的 Ajax 控件 takeit 问题
好吧,这是那些非常奇怪的错误之一,看起来像是机器在惹你生气。 我们有2个网站,ASP.NET,都是2.0,我们都将它们升级到4.0。 它们是完全相同的代码库,但 web.config 文件不同,它们指向不同的数据库,并且它们在 IIS 中作为单独的 Web 应用程序运行。
升级后,一个可以用,一个不能用。
不起作用的会在 Microsoft AJAX 控制工具包周围引发一堆 JavaScript 错误,例如“Sys 未定义”、“Type 未定义”和“__nonMSDOMBrowser 未定义”(在 firebug 中)。当我在 firebug 中使用“脚本”面板时,它列出了所有不同的“...ScriptResource.axd?d=IOBqtxq...”脚本,但是当我要求查看它们时,其中许多脚本将返回“无法加载源” : /ScriptResource.axd?d=IOBqtxq7p...'。
其中一些确实带着 CodePlex 版权和一些 javascript 回来了,但很多都没有。真正奇怪的事情是什么?如果我们回收损坏网站的应用程序池,那么我们第一次访问该网站时就不会收到这些错误。回发有效,我们登录,等等。然后我们返回并再次点击它,JavaScript 错误又回来了,并且没有回发。
有什么想法吗?
Ok, this is one of those really weird errors that seems like the machine's just messing with you.
We have 2 websites, ASP.NET, both were 2.0, and we upgraded them both to 4.0.
They're the same exact codebase, but the web.config files are different, they point at different databases, and they run as separate web apps in IIS.
After the upgrade, one works and one doesn't.
The one that doesn't work will throw a bunch of javascript errors around the Microsoft AJAX Control toolkit like 'Sys is not defined', 'Type is not defined', and '__nonMSDOMBrowser is not defined' (in firebug). When I use the Scripts panel in firebug it lists all the different '...ScriptResource.axd?d=IOBqtxq...' scripts, but when I ask to look at them, many of them will return 'Failed to load source for: /ScriptResource.axd?d=IOBqtxq7p...'.
A couple of them do come back with the CodePlex copyright and some javascript, but many of them don't. And the truly weird thing? If we recycle the app pool for the broken site, we don't get those errors the first time we hit the site. The postback works, we log in, etc. Then we go back and hit it again, javascript errors are back and no postbacks.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我讨厌回答自己的问题,但由于没有其他人参与其中,这是我们想出的最好的答案。
IIS 中有一个网站设置指定了 Web Garden 线程,我假设该设置是指如果该网站位于负载平衡的 Web Garden 中则要使用多少个线程。我们将这个新站点设置为 7,这就是 .NET 2.0 中的情况。显然 2.0 更宽容(或忽略它),但 4.0 却让人抓狂。对站点的单个请求是对许多不同资源的请求,这些资源最终由不同的线程处理,正如您可以想象的那样,这会造成混乱。而且每次都会不同,具体取决于哪些线程执行什么操作。
所以,除非其他人对此有解释,否则我将关闭它。
Ok, I hate answering my own questions, but since no one else is weighing in, this is the best we've come up with.
There's a setting in IIS for the website that specifies Web Garden Threads, which I assume is how many threads to use if the site is in a load balanaced web garden. We had this new site set to 7, which is how it was in .NET 2.0. Apparently 2.0 is more forgiving (or ignores it), but 4.0 freaks out. The single request to the site is a request for lots of different resources, which end up being handled by different threads, which as you can imagine makes for chaos. And it's different every time depending on which threads do what.
So, unless anyone else has an explanation for this, I'll close this.
从同一个应用程序池运行许多应用程序可能会导致非常奇怪的 ajax 行为。通常,您会在共享 DefaultAppPool 的应用程序中看到这种情况。
尝试为该应用程序创建一个单独的应用程序池。
Running many applications out of the same app pool can cause really strange ajax behaviors. Often times you'll see this with apps sharing the DefaultAppPool.
Try creating a separate app pool for the application.