This project is read-only.
1

Closed

Object reference not set to an instance of an object

description

I Publish the MvcCms 2.0 source successful. But deploy on iis6 and view in browser it occurred an error
File in : MvcCms 2.0\MvcCms.Web\MvcCms.Web\Controllers\HomeController.cs Line: 46
Source Error:
Line 44: {
Line 45: _currentPortal = _cacheService.GetCurrentPortal();
Line 46: ViewData["SiteName"] = _currentPortal.DisplayName;
Line 47: ViewData["DefaultLangID"] = _currentPortal.DefaultLanguage.LanguageID;
Line 48: IDictionary<string, object> routeTokens = RouteData.DataTokens;
error message: Object reference not set to an instance of an object
Closed Oct 19, 2010 at 6:45 AM by
This was due to not setting the portalauthority in the portals table before moving to iis.

comments

MvcCms wrote Oct 18, 2010 at 10:21 PM

Most likely the problem there is that you need to edit the portal urlauthority to the url you are using in iis.

What is the url in the browser when you get the message and I can give you the sql to update your portals table. I'll also need the portal id of the portal you want to show up from your portals table.

There are quite a few hoops to jump through to get 2.0 running on iis6, the wild-card mapping and installation and enabling of .net 4.

MvcCms determines what portal to show by matching the urlauthority or domain name from the request to the matching urlauthority in the portals table. If no match is found then you get that error.

I suppose some code there to take the user to a page explaining this might be a good way to handle that error. I added this as an enhancement to 2.0 here http://www.mvccms.com/wiki/mvccms-20