如何防止 ASP.NET 和 Kentico 处理静态文件
我有一个 Kentico CMS 网站,正在处理静态资源,例如 png 文件。我希望 ASP.NET 不处理这些文件。我该怎么做?
我正在使用 Kentico CMS(Web 表单)运行 IIS 7.5 和 ASP.NET 3.5。应用程序池是集成模式
我查看了 Web 配置文件中的
元素,但似乎实现它并没有什么区别。
更新:图像包含在名为 /res 的文件夹中,该文件夹是 webroot 文件夹的子文件夹。即不受 kentico、媒体库等管理。通过 Visual Studio 添加。
编辑:根本问题是我的主页上有大量图像,有时需要很长时间才能加载。有时,静态图像可能需要整整一分钟才能加载(引起我们的警惕)。我不能 100% 确定导致此问题的原因,这是故障排除的一个步骤。
I have a Kentico CMS website that is processing static resources, such as png files. I would like these files to not be processed by ASP.NET. How do I do this?
I am running IIS 7.5 and ASP.NET 3.5 with Kentico CMS (Web Forms). App Pool is integrated mode
I looked at the <location>
element in the web config file but it seemed implementing it didn't make a difference.
Update: the images are contained within a folder named /res, a child of the webroot folder. i.e. not managed by kentico, the media library etc. Added via Visual Studio.
edit: The underlying problem is my homepage has numerous images on it that are sometimes taking a long time to load. on occasions, static images can take a full minute to load (tripping our alarming). I'm not 100% sure what is causing this problem and this is a step in troubleshooting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
集成模式意味着所有请求将参与 ASP.NET 管道。我相信静态资源的最终处理程序将是来自 IIS 的静态文件处理程序,但在提供这些文件之前,您将看到 ASP.NET 模块和应用程序事件被触发(包括身份验证)。
也许,您应该详细说明您在 ASP.NET 和 ASP.NET 中遇到的问题。这些文件。通常,您可以关闭特定路径的 ASP.NET 模块。
由于您将这些文件放在子文件夹中,另一个解决方法可能是将子文件夹作为不同的应用程序,并在经典模式下在不同的应用程序池中提供这些文件。
Integrated mode means that all requests will participate in the ASP.NET pipeline. I believe that ultimate handler for static resources would be static file handler from IIS but before serving those files, you will see ASP.NET modules and application events getting triggered for the same (including authentication).
Perhaps, you should elaborate the problem that you faced w.r.t ASP.NET & these files. Typically, you can turn off ASP.NET modules for particular path(s).
As you have these files in a sub-folder, another work-around could be to make the subfolder as different application and serve these files in a different app-pool in classic mode.
如果文件直接放置在文件系统上(并且不在 Kentico CMS 的媒体库中使用),则 Kentico CMS 不会处理这些文件。无论如何,如果您想获得更好的性能,也许您应该考虑通过 CMS 界面添加它们 - 这样它们将由 CMS 引擎处理,您可以使用 Kentico CMS 中提供的缓存选项来提高性能。每次从磁盘加载文件可能并不总是检索文件的最快方法。
If the files are placed directly on the file system (and are not used within Media library in Kentico CMS) the Kentico CMS is not handling those files. Anyway, if you want to have better performance maybe you should consider adding them through the CMS interface - so they will be handled by the CMS engine and you can use the caching options available in Kentico CMS to improve the performance. Loading the files always, every time from the disk might not be always the fastest way how to retrieve them.