MVC路由正在拦截物理MP3文件
我有一个 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这里我意识到这个实例上的配置实际上有一个 mp3 重写规则.. nm...
and here's where i realize the config on this instance actually had a rewrite rule for mp3 in place.. nm...