如何将 Untiy 配置从 1.2.* 转换为 2.0.*
在 Unity 1.2 中,我在 web.config 中有此文本
; <构造函数> ; <依赖名称=“ApplicationRouteCollection”/> <依赖名称=“RegisterRoutesHandler”/> <依赖关系>
我在 Unity 2.0 中转换为以下文本。*
; <构造函数> <依赖名称=“ApplicationRouteCollection”/> <依赖名称=“RegisterRoutesHandler”/> <参数名称=“设置”类型=“IAppSettings”> <依赖关系>>
但出现了错误
无法解析类型名称或别名 RouteCollection。请检查您的配置文件并验证此类型名称。
在
IUnityContainertownhallContainer = new UnityContainer(); UnityConfigurationSection config = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); config.Configure(townhallContainer); // 我在这里遇到错误 返回townhallContainer;
如何将它们转换为 Unity 2.0 配置文件???
抱歉我的英语不好
In Unity 1.2, I had this text in web.config
<type type="IRouteRegistry" mapTo="TownHall.Mvc.Routing.TownHallRoutes,TownHall.Mvc"> <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration"> <constructor> <param name="routes" parameterType="RouteCollection"> <dependency name="ApplicationRouteCollection" /> </param> <param name="routeHandlerType" parameterType="System.Type"> <dependency name="RegisterRoutesHandler"/> </param> <param name="settings" parameterType="IAppSettings"> <dependency/> </param> </constructor> </typeConfig> </type>
I convert to bellow text in Unity 2.0.*
<register type="IRouteRegistry" mapTo="TownHall.Mvc.Routing.TownHallRoutes, TownHall.Mvc"> <constructor> <param name="routes" type="RouteCollection"> <dependency name="ApplicationRouteCollection" /> </param> <param name="routeHandlerType" type="System.Type"> <dependency name="RegisterRoutesHandler" /> </param> <param name="settings" type="IAppSettings"> <dependency /> </param> </constructor> </register>
But it got error
The type name or alias RouteCollection could not be resolved. Please check your >configuration file and verify this type name.
at
IUnityContainer townhallContainer = new UnityContainer(); UnityConfigurationSection config = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); config.Configure(townhallContainer); // I got error here return townhallContainer;
How do I convert them to Unity 2.0 configuration file ???
Sorry my bad English
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对不起大家,
我刚刚解决了这个问题。
问题来自 type="RouteCollection",我需要删除该文本
Sorry everyone,
I've just resolved this problem.
The Problem came from type="RouteCollection" and I need delete that text