静态文件在 IIS 中的路由与在 Cassini 中的路由相同

发布于 2024-10-02 03:59:37 字数 215 浏览 2 评论 0原文

我为 ASP.NET MVC 2 编写了一个自定义 VirtualPathProvider,它可以在程序集中搜索视图和静态内容,以便我可以在多个站点中重用内容。使用 Cassini 时它工作得很好,但是当我将站点部署到运行 IIS 7 的服务器时,静态文件只是返回 404,甚至没有通过 AssemblyPathProvider(我编写的类)进行路由。有谁知道如何强制 IIS 在这方面与 Cassini 一样工作?

I have written a custom VirtualPathProvider for ASP.NET MVC 2 that searches assemblies for views and static content so that I can reuse content in multiple sites. It works just fine while using Cassini, but when I deploy the site to a server running IIS 7, static files are just returning a 404 and not even getting routed through the AssemblyPathProvider (the class I wrote). Does anyone know how to force IIS to work the same as Cassini in this regard?

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

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

发布评论

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

评论(1

失而复得 2024-10-09 03:59:37

IIS 和卡西尼号绝对是两种不同的野兽。我同意@Sayed 的观点,即您应该尝试选择使用 IIS,特别是因为您的生产服务器正在运行 IIS。

在这方面,我进一步建议您使用IIS Express进行开发。它是轻量级的,并且不需要您的计算机上的管理员权限。它的行为也类似于 IIS,因为它就是 IIS。

以下是更多信息的链接:

IIS and Cassini are definately two different beasts. I would agree with @Sayed in that you should try to opt to use IIS, especially since your production server is running IIS.

In that regard, I would further recommend that you use IIS Express for development. It is lightweight, and doesn't require admin privileged on your machine. It also behaves like IIS because it is IIS.

Here's some links for more info:

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