网络托管告诉我需要在 web.config 中为静态内容添加 http 处理程序?

发布于 2024-10-03 00:14:54 字数 974 浏览 3 评论 0原文

我有一个与一家公司共享托管的 MVC2 应用程序...我们将其称为托管商。

我不认为 Hosters 支持 MVC2,但是当我连接实时聊天询问时,他们说要提交一张票,他们会为我安装 MVC2!非常酷!

快速等待后(Hosters 反应非常灵敏,总体对我来说很好),我收到一封电子邮件,说我的网站现在已全部设置为 MVC2。经过深思熟虑我应该使用哪个 MVC2 博客引擎,我将最新版本的 AtomSite 部署到新托管,我渴望让它继续下去。成功!我在访问我的网站时收到设置向导。但一切看起来都有点不对劲。我以前从未使用过 AtomSite,而且它还处于早期阶段,所以我对它没有什么看法。不管怎样,这个故事已经足够无聊了,它看起来有点不对劲的原因是它没有显示任何静态文件。

所有静态文件都给我一个 .NET 错误:

System.Web.HttpException: Failed to Execute URL.

这意味着所有请求都由 .NET 引擎处理。如果我向 web.config 添加处理程序:

<httpHandlers>
    ....
    <add verb="*" path="*.txt" type="System.Web.StaticFileHandler" />
</httpHandlers>

该站点现在可以正常显示 txt 文件。当我联系 Hosters 时,他们说我需要为我希望 StaticFileHandler 处理的所有扩展执行此操作。

这对我来说似乎是错误的?难道他们设置错了?我真的必须弄清楚需要添加到 httpHandlers 部分的所有扩展吗?如果没有,我需要告诉他们什么才能解决问题?过去我从未使用 MVC2 执行过此操作,即使在运行 IIS6 的开发计算机上也是如此。

如果我遗漏了任何重要的内容,我可以提供更多信息! 谢谢!

I have an MVC2 app on shared hosting with a company... we'll call them Hosters.

I didn't think Hosters supported MVC2, but when I connected live chat to ask they said to put in a ticket and they'll install MVC2 for me! Very cool!

After a quick wait (Hosters is very responsive and overall has been good to me), I got an email saying my site is all setup for MVC2 now. After much deliberation of which MVC2 blogging engine I should use, I deploy the latest release of AtomSite to the new hosting, and am dying to get it going. Success! I get the setup wizard when visiting my site. But everything looks slightly off. I've never used AtomSite before, and it's early in its life, so I don't think anything of it. Anyway, enough boring story, the reason it looked slightly off is because it wasn't showing any static files.

All static files are giving me a .NET error:

System.Web.HttpException: Failed to Execute URL.

This means all requests are being handled by the .NET engine. If I add a handler to the web.config:

<httpHandlers>
    ....
    <add verb="*" path="*.txt" type="System.Web.StaticFileHandler" />
</httpHandlers>

The site now shows txt files just fine. When I contacted Hosters, they said I needed to do that for all extensions I wanted the StaticFileHandler to handle.

This seems wrong to me? Did they set it up wrong? Do I really have to figure out ALL the extensions that need to be added to the httpHandlers section? If not, what do I need to tell them to get it sorted out? I've never had to do this with MVC2 in the past, even on my dev machine running IIS6.

I can provide more information if I left out anything important!
Thanks!

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

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

发布评论

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

评论(1

入画浅相思 2024-10-10 00:14:54

当您设置 IIS 来处理无扩展名 URL,只需在其他静态文件类型中进行“或”操作时,就会发生这种情况...“.txt|.png|.pdf|.gif |*.jpg" 等

this happens when you setup IIS to handle extensionless urls, just 'or' in the other static file types... ".txt|.png|.pdf|.gif|*.jpg" etc

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