共享托管环境中的自定义 ASP.NET MVC 缓存控制器?
我正在使用缓存静态资源(CSS、JS 等)和图像的自定义控制器。我目前正在与一家托管提供商合作,该提供商已为我建立了完全信任的配置文件。尽管完全信任,我的控制器还是失败了,因为缓存策略依赖于 File 类在处理和存储在内存中之前直接打开资源文件。
这是在所有完全信任的共享托管环境中都可能发生的情况还是特定于我的主机?静态文件位于我的应用程序结构内,而不是位于任意服务器路径中。在我看来,自定义缓存需要代码来直接访问文件,我希望其他人已经处理了这个问题。
I'm using custom controllers that cache static resources (CSS, JS, etc.) and images. I'm currently working with a hosting provider that has set me up under a full trust profile. Despite being in full trust, my controllers fail because the caching strategy relies on the File class to directly open a resource file prior to treatment and storage in memory.
Is this something that would likely occur in all full trust shared hosting environments or is this specific to my host? The static files live within my application's structure and not in an arbitrary server path. It seems to me that custom caching would require code to access the file directly, and am hoping someone else has dealt with this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,要执行此操作,您需要模拟 IIS 用户以获得文件系统访问权限。如果您无法在共享托管环境中执行此操作,那么您需要更改服务提供商(我们已迁移到 EC2)。
Basically, to do this you need to impersonate the IIS user to gain file system access. If you can't do this in a shared hosting environment, then you need to change service providers (we moved to EC2).