Object reference not set to an instance of an object

Posted by Community Admin on 05-Aug-2018 07:21

Object reference not set to an instance of an object

All Replies

Posted by Community Admin on 23-Feb-2011 00:00

I'm trying to get Sitefinity to run in IIS on my local Windows 7 development machine. I followed many of the instructions I found in the documentation and forum posts and have successfully battled errors such as SQL connection issues as well as access denied issues. But now I'm dealing an error that has me stumped.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Sitefinity.Web.SiteMapBase.IsAccessibleToUser(HttpContext context, SiteMapNode node) +68
   Telerik.Sitefinity.Web.SitefinitySiteMap.IsAccessibleToUser(HttpContext context, SiteMapNode node) +19
   Telerik.Sitefinity.Web.PageSiteNode.IsAccessibleToUser(HttpContext context) +17
   Telerik.Sitefinity.Web.SiteMapBase.ReturnNodeIfAccessible(SiteMapNode node) +42
   Telerik.Sitefinity.Web.SiteMapBase.GetRootNodeCore(Boolean ifAccessible) +563
   Telerik.Sitefinity.Web.SiteMapBase.GetRootNodeCore() +15
   Telerik.Sitefinity.Web.SiteMapBase.FindSiteMapNode(String rawUrl, Boolean ifAccessible, Boolean fallbackToOtherLanguageVersion, Boolean& isExactMatch) +1241
   Telerik.Sitefinity.Web.SiteMapBase.FindSiteMapNode(String rawUrl, Boolean ifAccessible) +27
   Telerik.Sitefinity.Web.SitefinityRoute.GetRouteData(HttpContextBase httpContext) +483
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +285
   System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60
   System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


I can run my website just fine from when using the virtual server from Visual Studio or the Sitefinity Project Manager. I just can't run it from IIS. Any ideas?

Michael

Posted by Community Admin on 23-Feb-2011 00:00

Hello Michael,

It is possible that something on your server changes the HttpContext. The error is thrown because something inside IsAccessibleToUser is null or one of the parameters - HttpContext or Node is null.

Can you try to replicate the issue with the latest internal build as well.

Best wishes,
Ivan Dimitrov
the Telerik team

Posted by Community Admin on 23-Feb-2011 00:00

I believe I'm already using the latest build (4.0.1160.0). Is there a more recent internal build?

Posted by Community Admin on 23-Feb-2011 00:00

Without sounding too desperate, I'm really needing to get this resolved soon. I was scheduled to demonstrate Sitefinity to those that have the money yesterday but unfortunately, that didn't happen.  I can only delay for so long. Yes, I have successfully demonstrated my project using both the internal web servers from Visual Studio and the Sitefinity Project Manager, but now I need to demonstrate Sitefinity in IIS.

I even downloaded the Charity starter kit project and it too is complaining about the "Object reference" error. I have yet to find any documentation that clearly outlines everything that is required to get a Sitefinity project running under IIS. I'm sure this is quite trivial to some but unfortunately, I'm having a bear of time getting this to work. I have other .Net projects (applications) running on the same machine which connect to the same SQL Server and they work just fine so I'm very confused about what's happening with my Sitefinity project.

Thanks again,
Michael

Posted by Community Admin on 24-Feb-2011 00:00

Sitefinity v4.0.1160.0
Win 7 Pro IIS 7.5

I just found and watched a video that focuses specifically on getting Sitefinity 4 to run under IIS. So I follow all the steps outlined in the video but I'm still having issues. There are some differences, though, that I will share. My environment is Windows 7 Pro so I am forced to add my project as a virtual directory under the Default Web Site and I also had to convert the virtual directory to an Application. I'm using port 80 whereas in the video, the setup used port 81. Other than this, everything should be the same.

So, after creating the project and setting up IIS exactly as in the video with my new SitefinityDemo project, I could successfully get to localhost/sitefintitydemo. That is, I get the page with the message "Thank you for visiting ... Please return soon for updates."

After this, the next step in the video shows to add "Sitefinity" to the end of the URL which takes you through a wizard to setup the database, admin user and ultimately launching the back end admin.

In my example, this didn't happen. When I add "sitefinity" to the end of the URL (localhost/.../sitefinity), I don't go to the wizard for additional setup options. I stay on the same page but the URL changes to localhost/.../login.aspx

In addition, using Firebug, I see that there are two errors on the page (I've also included a screen shot of browser with this information).

Sys is not defined
Sys.WebForms.PageRequestManager._initialize('ctl00', 'form1', [], [], [], 90, '');
Line 67
 
and
 
Sys is not defined
Sys.Application.setServerId("ctl00", "ctl00");
Line 73

Any ideas what I could be doing wrong?

Michael

Posted by Community Admin on 24-Feb-2011 00:00

Perhaps the issue is using a virtual directory. I went ahead and setup a new website under IIS and used port 81, just as the video demonstrated, and now everything seems to work.

The documentation, though, outlines that virtual directories are supported. Is this not the case?

Michael

Posted by Community Admin on 28-Feb-2011 00:00

Hi Michael,

There should not be a difference if you use virtual directory or website in IIS. Errors of type Sys is not defined generally means that there is problem with the AJAX on the server. Sys undefined  means that you're not getting the client side files loaded on your browser.The problem is that ASP.NET ajax libraries could be loaded. Sys is the root namespace for all MS AJAX client classes. The RadEditor control uses them and since they are not loaded and normal behavior of the control is broken and it could not work properly. Here are two useful posts.



Best wishes,
Ivan Dimitrov
the Telerik team

This thread is closed