MVC路由正在拦截物理MP3文件

发布于 2024-12-25 01:47:16 字数 1415 浏览 5 评论 0原文

我有一个 MVC 应用程序,其目录包含一堆媒体、png、mp3 等...

png 文件运行良好,但 mp3 文件在 MVC 路由中被拾取。

我已将文档根目录更改为非mvc目录(仅指向内容目录)并且它可以很好地提供mp3,因此这不是iis问题,而是mvc路由问题。

那么...为什么它要获取 .mp3 扩展名?我没有任何带有 mp3 的路线...

抛出的错误是(没有帮助)

[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +12673141
System.Collections.Generic.Dictionary`2.ContainsKey(TKey key) +9
StructureMap.Util.Cache`2.get_Item(KEY key) +97
StructureMap.BuildSession.CreateInstance(Type pluginType) +16
Utility.StructureMapControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in c:\xx\Utility\StructureMapControllerFactory.cs:18
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +85
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +280
System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +66
System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +161
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

I have a MVC app with a directory containing a bunch of media, png, mp3, etc...

The png files serve fine, but the mp3 files are getting picked up in MVC routing.

I've changed the document root to a non mvc directory (just pointed to the content directory) and it serves the mp3 fine, so it's not an iis issue, but an mvc routing issue.

so... why is it grabbing the .mp3 extension? I dont have any routes with mp3 in them...

the error thrown is (not helpfully)

[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +12673141
System.Collections.Generic.Dictionary`2.ContainsKey(TKey key) +9
StructureMap.Util.Cache`2.get_Item(KEY key) +97
StructureMap.BuildSession.CreateInstance(Type pluginType) +16
Utility.StructureMapControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in c:\xx\Utility\StructureMapControllerFactory.cs:18
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +85
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +280
System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +66
System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +161
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

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

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

发布评论

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

评论(1

渡你暖光 2025-01-01 01:47:16

在这里我意识到这个实例上的配置实际上有一个 mp3 重写规则.. nm...

and here's where i realize the config on this instance actually had a rewrite rule for mp3 in place.. nm...

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