Kentico 9 MVC - calling Smart Search causes IIS Express worker process to crash

Marcel Guldemond asked on December 17, 2015 21:23

Our client's old site is built in an earlier version of MVC, but they now want some of the Kentico features like Smart Search and online content editing.

We were working on it in Kentico 8, but upgraded to 9 because we thought it would make the MVC part easier, such as bringing in a lot of our existing MVC code, and writing the more code heavy pages in MVC instead of trying to make custom webparts for everything, so that it would be a portal/mvc hybrid. The client can work on their content pages, and we can quickly hook up some MVC pages to our existing infrastructure.

However, nothing's working very well right now, we're having a lot of trouble with it. There was a ton of config wrestling to get the MVC site to work as a virtual directory under the CMSApp. Now this error keeps coming back when trying to hit an MVC route: http://stackoverflow.com/questions/1120329/could-not-load-type-mvcapplication

and if that doesn't happen, most of the time when I try to call Smart Search using the API from an MVC controller while debugging, the IIS Express worker process crashes, so I have no idea where the problem is.

Recent Answers


Bryan Soltis answered on December 17, 2015 21:33

Hi Marcel,

Have you checked out the Kentico MVC Demo on GitHub? It has all of our current MVC functionality incorporated into it. You can download that project and see how the Smart Search functionality works and possibly use it as a guide in your project. We will continue to update the GitHub project as we build out more the MVC support.

https://github.com/Kentico/Mvc

0 votesVote for this answer Mark as a Correct answer

Marcel Guldemond answered on December 17, 2015 21:55 (last edited on December 17, 2015 21:57)

That's exactly the one we've been working off of.

We currently have the MVC app set up in a virtual directory of the CMS App, in the same solution. When we started with K8, we used the MVC code in the root of the CMS app, but when we upgraded to K9, we were told by phone support that it would be better to put our MVC project in a subdirectory/virtual directory.

One thing that we did do differently was to explicitly set up the SearchService in the controller's constructor, instead of receiving one from a parameter. Is maybe that the issue?

 public SearchController()
    {

        var indexInfos = SearchIndexInfoProvider.GetSearchIndexes();

        string[] indexNames = (from i in indexInfos
            select i.IndexCodeName).ToArray();

        mService = new SearchService( indexNames, CultureHelper.GetDefaultCultureCode( "SCGDEV" ), "SCGDEV",true );
    }
0 votesVote for this answer Mark as a Correct answer

Bryan Soltis answered on December 18, 2015 14:27

Ah OK. Unfortunately, my MVC knowledge is pretty limited. I have reached out to our dev team to see if they have any suggestions. I will let you know if they come back with something. My only thought is I have only done MVC with Kentico with the MVC project being a completely separate application. This would resolve the routing issues as it would be a standalone piece. I also know that is how the MVC demo is set up.

0 votesVote for this answer Mark as a Correct answer

Bryan Soltis answered on December 18, 2015 16:32

Hi Marcel,

I heard back from our devs and apparently there is an issue with the Glimpse.Core library taking up all of the memory and IIS ends up with an OutOfMemory error when i tries to serialize some objects.

We are looking into it and hopefully will have a fix soon. You can also enter a support ticket for the issue and they will keep you updated on the status.

0 votesVote for this answer Mark as a Correct answer

Marcel Guldemond answered on December 21, 2015 15:09

Ok, thanks Bryan. I can try moving the mvc portion of the app to a separate solution and see what happens when I debug the portal webapp and the mvc pages at the same time. They'll still have to be on the same port because they'll both be on the same domain when we're running live.

I'll also open a ticket. Hopefully they can fix it soon, because we have some deadlines for this project coming up in January.

thanks, Marcel

0 votesVote for this answer Mark as a Correct answer

Marcel Guldemond answered on December 23, 2015 22:25

Something I've discovered in the meantime: deploying this code to our dev server and testing it there doesn't throw the same error. The search method just doesn't return any results, even when the same search text is used that returns results on the Search Index's preview page.

Now I've got another error that only seems to happen in the Kentico solution: the MVC app can't parse the Global.asax file. :(

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.