我试图在我的 MVC - Sitecore - 7.1 中的 v4.0.30319 项目中使用 Glass Mapper。
以下是我安装的 Glass Mapper 版本
当我从 nuget 安装 Glass mapper Mvc 时,它在 App_Config -> 包含文件夹中添加了一个名为 (Glass.Mapper.Sc.Mvc) 的配置文件
文件内容如下
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings></settings>
<pipelines>
<mvc.getModel>
<processor type="Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc"/>
</mvc.getModel>
</pipelines>
</sitecore>
</configuration>
现在当我运行我的网站时,它给了我以下错误(运行上面配置中提到的管道时)
Could not resolve type name: Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc (method: Sitecore.Configuration.Factory.CreateType(XmlNode configNode, String[] parameters, Boolean assert))
但引用已经存在?
我错过了任何步骤吗?有人可以帮忙吗。
最佳答案
Glass Mapper 的开发人员最近将一些类移到了单独的 MVC 程序集中,并且没有更改配置文件。无法加载的类现在在 Glass.Mapper.Sc.Mvc
中程序集,因此您的配置应如下所示:
<mvc.getModel>
<processor type="Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc.Mvc"/>
</mvc.getModel>
关于asp.net-mvc-4 - 无法解析类型名称 : Glass. Mapper.Sc.Pipelines.Response.GetModel、Glass.Mapper.Sc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24299806/