简体   繁体   中英

Error when using Ninject( Version Ninject v3.0.0) IOC for Sitecore 7.5 solr

I got error "Invalid cast from 'System.String' to 'Sitecore.ContentSearch.ProviderIndexConfiguration'." after adding in Global.ascx

  <%@Application Language='C#' ' Inherits="Sitecore.ContentSearch.SolrProvider.NinjectIntegration.NinjectApplication" %> 

I haven't tried setting up SOLR with Ninject but I've got this working with CastleWindsor in the global.asax as follows:

<%@Application Language='C#' Inherits="Sitecore.Web.Application" %>
<%@ Import Namespace="Castle.Windsor" %>
<%@ Import Namespace="Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration" %>

<script runat="server">

public Castle.Windsor.IWindsorContainer Container { get; set; }

public void Application_Start() {
 try
 {
   // start up solr
   this.Container = new Castle.Windsor.WindsorContainer();
   var startup = new Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorSolrStartUp(this.Container);
   startup.Initialize();
 }
 catch(Exception e){

    Sitecore.Diagnostics.Log.Error("Cannot connect to Solr", e, this);      }
}
</script>

It should be a case of swapping out the CastleWindsor for Ninject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM