ASP.NET MVC 升级到 Beta:IControllerFactory 定义在未引用的程序集中

发布于 2024-07-10 07:11:15 字数 833 浏览 8 评论 0原文

我目前正在将网站从 ASP.NET MVC 预览版 2 更新到 Beta 版本。 经过详尽的搜索后,我遇到了最后一个编译错误,但在站点中没有解决方案。 我在 Global.asax.cs 中有一些代码,它使用 Windsor 容器设置 IOC:

ControllerBuilder.Current.SetControllerFactory(typeof(WindsorControllerFactory));

编译器抱怨:

The type 'System.Web.Mvc.IControllerFactory' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

奇怪的是这个程序集引用。 我从 MVC beta 程序集文件夹引用它并设置为复制本地。 我什至可以删除 bin 目录,重建,然后在反射器中查看程序集并查看界面。 我尝试删除并重新添加引用,更改 web.config 的程序集和命名空间部分。 我什至从 GAC 中删除了 System.Web.Mvc 以确保它使用正确的副本。

在写这个问题时,我突然想到,也许温莎内部期待旧版本的程序集。 我正在从 MvcContrib 下载最新版本以确定这是否是问题所在,我将发布结果。 如果是这种情况,程序集的版本号是否应该随最新版本而更改以使这一点变得明显?

谢谢阅读, 布雷特

I'm currently in the process of updating a site from preview 2 of ASP.NET MVC to the Beta release. I'm down to my last compile error with no solution in site after an exhaustive search. I have some code in Global.asax.cs which sets up IOC using the Windsor container:

ControllerBuilder.Current.SetControllerFactory(typeof(WindsorControllerFactory));

The compiler is complaining that:

The type 'System.Web.Mvc.IControllerFactory' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

The weird thing is that this assembly is referenced. I reference it from the MVC beta assemblies folder and set to copy local. I can even delete the bin directory, rebuild, then view the assembly in reflector and see the interface. I've tried removing and re-adding the reference, changing web.config's assemblies and namespace sections. I even removed System.Web.Mvc from the GAC to make sure it was using the correct copy.

While writing this question it occurred to me that perhaps Windsor is internally expecting the older version of the assembly. I'm downloading the latest from MvcContrib to determine if this is the issue and I'll post the result. If this is the case, shouldn't the version number of the assembly have changed with the latest release to make this obvious?

Thanks for reading,
Brett

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

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

发布评论

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

评论(2

乱了心跳 2024-07-17 07:11:16

检查您是否已将 web.config 文件中的相应程序集引用更新为 3.5.0.0,如 Beta 版更新说明中所述。

Check that you've updated the appropriate assembly references to 3.5.0.0 in your web.config file, as described in the update notes for the beta.

鹤仙姿 2024-07-17 07:11:15

PublicKeyToken=null 似乎不正确...

编辑: 我是对的,PublicKeyToken 应该是“31bf3856ad364e35”。 听起来它们与未签名的 System.Web.Mvc.dll 的私有版本链接。

PublicKeyToken=null doesn't seem right...

Edit: I was right, the PublicKeyToken should be "31bf3856ad364e35". It sounds like they're linked against a private build of System.Web.Mvc.dll that isn't signed.

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