Umbraco / TeamCity BuildAgent nullReference error showing in Event Viewer - umbraco

I'm noticing a strange error cropping up regularly with a site I've inherited the maintenance of from a former colleague.
Does it ring any bells for any of you out there?
It's an umbraco v 4.0.4.2 site, and TeamCity is most definitely NOT installed on this machine.
Here's the message:
Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
Request information:
Request URL: http://www.[[some website name]].co.uk/default.aspx
Request path: /default.aspx
User host address: [[some ip address]]
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 1
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace:
at umbraco.requestHandler..ctor(XmlDocument _umbracoContent, String url) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\requestHandler.cs:line 230
at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\default.aspx.cs:line 113
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnPreInit(EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details:
For more information, see Help and Support Center at

The reference to Teamcity is just telling where the original file was compiled from in the filesystem.
It is most likely that you are missing a dll in the bin folder.

Related

TFS build failing because of registry access is not allowed

I am configuring New bulid server I am having TFS 2013. I am an admin on the build server and the account which is used for configuring build server is also a admin on build server.
I am able to access my TFS and able to Checkin code as well from build server.
I don't know what access rights I have to give to my user or to the account used for configuring build server.
Exception Message: Requested registry access is not allowed. (type SecurityException)
Exception Stack Trace:
Server stack trace:
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.TeamFoundation.Common.Internal.TeamFoundationEnvironment.OpenOrCreateRootUserRegistryKey()
at Microsoft.TeamFoundation.VersionControl.Client.Workstation.get_AttemptToAutoResolveConflicts()
at Microsoft.TeamFoundation.VersionControl.Client.Client.Get(Workspace workspace, GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, Object userData, String[] itemAttributeFilters, String[] itemPropertyFilters, Boolean alwaysQueryConflicts, Conflict[]& conflicts, Int32 operationId)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Get(GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, Object userData, String[] itemAttributeFilters, String[] itemPropertyFilters, Boolean alwaysQueryConflicts, Conflict[]& conflicts)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Get(GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, Object userData)
at Microsoft.TeamFoundation.Build.Workflow.Activities.TfGet.TfGetCore.RunCommand(VersionControlScope versionControlScope, Workspace workspace, String getting, String nonFatalError, String version, String fileSpec, GetOptions options, RecursionType recursion)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Func`9.EndInvoke(IAsyncResult result)
at Microsoft.TeamFoundation.Build.Workflow.Activities.TfGet.TfGetCore.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity`1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
The service account configured for the build service needs the rights. The TFS service and the build service may or may not be configured to run under the same account. Your personal account is not part of this equation.
MSDN outlines the permissions required for each service account here https://msdn.microsoft.com/en-us/library/ms253149(v=vs.120).aspx Look at the entry for TFSBuild
The setup is also outlined in https://msdn.microsoft.com/en-gb/library/ms181712(v=vs.120).aspx and explains how to pick what type of account you should choose when setting up your build server

Mvc 3 application stops randomly (especially after recycle) IIS 7.5 Integrated mode

we have an MVC 3 application which works under IIS 7 and application pool Managed Pipeline Mode is Integrated.
This application suddenly become unstable which means gives error like below.
Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 04.02.2014 12:01:16
Event ID: 1309
Task Category: Web Event
Level: Warning
Keywords: Classic
User: N/A
Computer:
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 04.02.2014 12:01:16
Event time (UTC): 04.02.2014 10:01:16
Event ID: 9896973154a54e5b88e6f1799922e853
Event sequence: 6
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/3/ROOT-1-130359816693915362
Trust level: Full
Application Virtual Path: /
Application Path: D:\WebSites\
Machine name: DC1VMCIFWEB02
Process information:
Process ID: 4152
Process name: w3wp.exe
Account name: NT AUTHORITY\SYSTEM
Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
at System.Web.PipelineModuleStepContainer.GetEventCount(RequestNotification notification, Boolean isPostEvent)
at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
Also this is our global.asax.cs code and i was wondering that anything wrong with this code;
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
log4net.Config.XmlConfigurator.Configure();
}
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
Response.Cache.SetExpires(DateTime.Now.AddSeconds(0));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetValidUntilExpires(true);
if (HttpContext.Current.Session != null)
{
CultureInfo ci = (CultureInfo)this.Session["Culture"];
if (ci == null)
{
string langName = "tr";
if (HttpContext.Current.Request.UserLanguages != null && HttpContext.Current.Request.UserLanguages.Length != 0)
{
langName = HttpContext.Current.Request.UserLanguages[0].Substring(0, 2);
}
ci = new CultureInfo(langName);
this.Session["Culture"] = ci;
}
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
}
}
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
Application[HttpContext.Current.Request.UserHostAddress.ToString()] = ex;
Class.LogClass.Error(this.GetType().ToString(), "Application_Error : ", ex);
}
Regarding this line:
Application[HttpContext.Current.Request.UserHostAddress.ToString()] = ex;
Per MSDN:
Application state is stored in memory on the server, so a large amount of data in application state can fill up server memory quickly. If the application is restarted, application state data is lost. Application state is not shared between multiple servers within a Web farm or between worker processes in a Web garden. Finally, application state is free-threaded, so any data that is stored in application state must have built-in synchronization support. For more information about these considerations, see ASP.NET Application State Overview and ASP.NET State Management Recommendations.
Basically, you are storing a list of global variables that are UserHostAddress/Exception object maps. Essentially, this is the last error for every IP address who visited the site since the last application pool recycle. Since this state is only wiped out when the application pool recycles, it will act like a slow memory leak. The longer your application pool timeout, and the more likely a user gets an exception somewhere, the more likely you will run the server out of memory.
It is unclear why you are putting the exception into a persistent location, but if your intent is to allow the current request to be able to show the exception a better choice would be to store it in HttpContext.Items, which will only last the lifetime of the current request. This will ensure that application errors don't eventually run the server out of memory.
I don't know for certain this is what is causing your application to be unstable, but it is a good place to start.

500 errors when loading .axd files in Sitecore CMS

I am running Sitecore 6.6.0-Update 4, MVC. When I attempt to load the Content Editor, all resources load normally except for the /WebResource.axd and /ScriptResource.axd files. This causes errors when attempting to load the Rich Text Editor, and presumably causes errors elsewhere, as well.
I have verified that routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); is present in Global.asax. Is there anywhere else I can look to troubleshoot this issue?
Here is a copy of one of the error messages, retrieved from Fiddler:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Specified method is not supported.
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.NotSupportedException: Specified method is not supported.
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:
[NotSupportedException: Specified method is not supported.]
System.Web.Routing.StopRoutingHandler.GetHttpHandler(RequestContext requestContext) +36
Sitecore.Mvc.Routing.RouteHandlerWrapper.GetHttpHandler(RequestContext requestContext) +33
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +11507752
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web .HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
What version of MVC did you use? Sitecore 6.6 only supports MVC3, you will get errors with MVC4.
Also - are you using the Sitecore supplied Global.asax or the standard MVC one? The Sitecore version should not have any routing info in there. Here is a copy of my global asax from a 6.6 MVC implementation:
<%#Application Language='C#' Inherits="Sitecore.Web.Application" %>
<script runat="server">
public void Application_Start() {
}
public void Application_End() {
}
public void Application_Error(object sender, EventArgs args) {
}
public void FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs args)
{
string frameworkVersion = this.GetFrameworkVersion();
if (!string.IsNullOrEmpty(frameworkVersion) && frameworkVersion.StartsWith("v4.", StringComparison.InvariantCultureIgnoreCase))
{
args.User = Sitecore.Context.User;
}
}
string GetFrameworkVersion()
{
try
{
return System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
}
catch(Exception ex)
{
Sitecore.Diagnostics.Log.Error("Cannot get framework version", ex, this);
return string.Empty;
}
}
</script>
How did you setup MVC? If in doubt follow John Wests blog on setting it up.
I'm using Sitecore 6.6 with MVC 4 and everything is working fine. I had same problem as yours, but I commented this line
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); // commented this line
in Global.asax and this helps.

Umbraco v6 Deploy to production server getting DB exception, content and media trees not loading

We just deployed a new v6 site to a host that has several v4 sites running on it no problem. On the front end, it looks fine, but in the Umbraco admin the Content and Media trees appear empty.
In the browser debugger I can see that there is an error in the TreeDataService.ashx.
The error is below and I'm not exactly sure what the issue is. Is it permissions? Database user permissions?
----------
You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider
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.ArgumentNullException: You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider
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:
[ArgumentNullException: You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig' to use an sql syntax provider
Parameter name: SqlSyntaxProvider]
Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig.get_SqlSyntaxProvider() +89
Umbraco.Core.Persistence.Mappers.BaseMapper.GetColumnName(Type dtoType, PropertyInfo dtoProperty) +57
Umbraco.Core.Persistence.Mappers.ContentMapper.Map(String propertyName) +67
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitMemberAccess(MemberExpression m) +112
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +101
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitBinary(BinaryExpression b) +258
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +159
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.VisitLambda(LambdaExpression lambda) +120
Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1.Visit(Expression exp) +72
Umbraco.Core.Persistence.Querying.Query`1.Where(Expression`1 predicate) +20
Umbraco.Core.Services.ContentService.GetChildren(Int32 id) +312
umbraco.cms.businesslogic.web.Document.GetChildrenForTree(Int32 NodeId) +39
umbraco.cms.presentation.Trees.BaseContentTree.Render(XmlTree& Tree) +27
umbraco.loadContent.Render(XmlTree& tree) +19
umbraco.presentation.webservices.TreeDataService.LoadTree(TreeRequestParams treeParams) +79
umbraco.presentation.webservices.TreeDataService.GetXmlTree() +140
umbraco.presentation.webservices.TreeDataService.ProcessRequest(HttpContext context) +55
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
check you umbraco db connection string.
<add name="umbracoDbDSN".......
if it do contains
providerName="System.Data.SqlClient"
then Add it and check. the same. it might start working.
Problem is that SqlSyntaxProvider is null, my workaround is init it.
var service = new Umbraco.Core.Services.ContentService();
SqlSyntaxContext.SqlSyntaxProvider = new MySqlSyntaxProvider();
The connection string, add name="umbracoDbDSN" ... was missing the following providerName="System.Data.SqlClient"
Once I added that to the line things started working.

How do I implement Move and Sort in an Umbraco custom section

I've created two custom sections which populate their trees from external (non-umbraco) tables. I've created implementations of ITaskReturnUrl to handle creation and deletion of nodes - this works fine. How do I make it work with the menu actions: Sort and Move?
I've added the appropriate actions to the menu of the nodes but when I click the action I get this error:
No node exists with id '1'
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.ArgumentException: No node exists with id '1'
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:
[ArgumentException: No node exists with id '1']
umbraco.cms.businesslogic.CMSNode.setupNode() +239
umbraco.cms.businesslogic.CMSNode..ctor(Int32 Id) +36
umbraco.dialogs.moveOrCopy.Page_Load(Object sender, EventArgs e) +1241
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
umbraco.BasePages.BasePage.OnLoad(EventArgs e) +14
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Frederik
I decided to implement my own Sort-page with jquery-ui.
To reach the new page I created a new class implementing the IAction-interface (full version):
public string JsFunctionName
{
get
{
return "OpenSortWindow();";
}
}
public string JsSource
{
get { return "function OpenSortWindow(){ var node = UmbClientMgr.mainTree().getActionNode();UmbClientMgr.openModalWindow('/Umbraco/Dialogs/RaceNodeSort.aspx?id='+ node.nodeId, 'Sort items', true, 350, 380); }"; }
}
The javascript opens a new dialog with my aspx-side that lets the user sort the elements. Please note that I use the UmbClientMgr.mainTree().getActionNode() to get the current node and read the nodeId-property which I insert into the URL of the page to passe this to the page.
This Action-class is then inserted into the context-menu through:
courseNode.Menu.Add(new RaceSortAction());

Resources