Nav 2017. Problem executing tasks from the queue navision.

EvgenyEvgeny Posts: 7Member
Hello colleagues!

I have navision 2017, cumulative update 11, build 18609,
virtual machine in Azure: D2, 7Mb RAM
Windows Server Datacenter 2016.
Ms sql server 2016 standard, ms office 2010

Installed:
Service DynamicsNAV100. A default installation. Not in the domain, no AD.
The service starts under NETWORK SERVICE.
Navision Application Service (NAS) named NavBatch. Starts under NETWORK SERVICE.

The problem is that when the NavBatch executes the job from the navision queue error occurs:

Server instance: NavBatch
Category: TaskScheduling
ClientSessionId: 00000000-0000-0000-0000-000000000000
ClientActivityId: 00000000-0000-0000-0000-000000000000
ServerSessionUniqueId: 00000000-0000-0000-0000-000000000000
ServerActivityId: 00000000-0000-0000-0000-000000000000
EventTime: 11/10/2017 22:59:38
Message <ii>(PrincipalServerDownException): <ii>The server could not be contacted.
ExceptionStackTrace:
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval()
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password)
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType)
at Microsoft.Dynamics.Nav.Runtime.NavUser.JoinUserGroupsWith(IdentityReferenceCollection listOfGroups, ContextType typeOfGroups)
at Microsoft.Dynamics.Nav.Runtime.NavUserAuthentication.AuthenticateTaskSchedulerCredential()
at Microsoft.Dynamics.Nav.Runtime.NavUserAuthentication.Authenticate()
at Microsoft.Dynamics.Nav.Runtime.NavUserAuthentication..ctor(NavTenant tenant, NavClientCredentialType authenticationType, UserType userType, Object token, String userName, String authenticationKey, String authorizationCode, IAzureADGraphQuery azureADGraphQuery, Func`1 getWindowsIdentity)
at Microsoft.Dynamics.Nav.Runtime.NavTenant.Microsoft.Dynamics.Nav.Runtime.ITenantSessionHandler.CreateTaskSchedulerSession(Guid userGuid, String userName, TimeZoneInfo timeZone)
at Microsoft.Dynamics.Nav.Runtime.NavTaskScheduler.TaskRunInfo.InternalRun()
CallerStackTrace:
at Microsoft.Dynamics.Nav.Runtime.NavTaskScheduler.TaskRunInfo.InternalRun()
at Microsoft.Dynamics.Nav.Runtime.NavTaskFactory.<>c__DisplayClass1_0.<RunTask>b__0()
at System.Threading.Tasks.Task.Execute()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
at System.Threading.ThreadPoolWorkQueue.Dispatch()

</ii></ii>
ProcessId: 4284
Tag: 00000B4
ThreadId: 11
CounterInformation:

The job fails, its status is Ready and not scheduled.
Services DynamicsNAV100 and the NasBatch was running and under the user .nas. The result is the same.
.nas - local admin, sysadmin sql server, navision user with SUPER rights.

Can anyone suggest a reason? Dealing with the issue for 2 weeks (
Thanks.

Comments

  • JuhlJuhl Posts: 507Member
    Create an extra instance and activate Scheduler on this and deactivate all others.
    Make sure this instance runs as windows authentication.

    See what that does.
    It also good practice, so you can restart NAS without kicking users.
    Follow me on my blog juhl.blog
  • EvgenyEvgeny Posts: 7Member
    Thank you for your response. The NAS is running in a separate instance. I tried to run it under NETWORK SERVICE and under a user of the administrator. Error in Event Log is the same.
    Judging by the error: at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
    in my opinion, is lacking some rights.
  • JuhlJuhl Posts: 507Member
    Sounds like permission issues. But I saw something about NavUser authentication in the log.
    The Nas instance is running on windows auth ???
    Follow me on my blog juhl.blog
  • JuhlJuhl Posts: 507Member
    Try SYSTEM account, it has access to config files.
    Follow me on my blog juhl.blog
  • EvgenyEvgeny Posts: 7Member
    Could you tell, how to assign the SYSTEM account for the service NAS? It is not in the list of users "Select User".
  • JuhlJuhl Posts: 507Member
    Select it on service in windows.
    Follow me on my blog juhl.blog
  • EvgenyEvgeny Posts: 7Member
    I tried to Log On under Local System account without a flag "Allow service to interact with desktop" and with flag. Error in Event Log remains the same.
  • EvgenyEvgeny Posts: 7Member
    Authentication of NavBatch service is Windows

    <appSettings>
    <add key="NetworkProtocol" value="Default" />
    <add key="DatabaseServer" value="KRUS-NAV" />
    <add key="DatabaseInstance" value="NAVDEMO" />
    <add key="DatabaseName" value="KRUS" />
    <add key="DatabaseUserName" value="" />
    <add key="ProtectedDatabasePassword" value="" />
    <add key="EnableSqlConnectionEncryption" value="false" />
    <add key="TrustSQLServerCertificate" value="false" />
    <add key="ServerInstance" value="NavBatch" />
    <add key="ClientServicesPort" value="7056" />
    <add key="SOAPServicesPort" value="7057" />
    <add key="ODataServicesPort" value="7058" />
    <add key="ManagementServicesPort" value="7055" />
    <add key="ManagementServicesEnabled" value="true" />
    <add key="ClientServicesEnabled" value="true" />
    <add key="ReportPDFFontEmbedding" value="true" />
    <add key="EnableSaveToWordForRdlcReports" value="true" />
    <add key="EnableSaveToExcelForRdlcReports" value="true" />
    <add key="EnableSaveFromReportPreview" value="true" />
    <add key="CompileBusinessApplicationAtStartup" value="true" />
    <add key="SOAPServicesEnabled" value="False" />
    <add key="ODataServicesEnabled" value="False" />
    <add key="ODataServicesV3EndpointEnabled" value="true" />
    <add key="ODataServicesV4EndpointEnabled" value="true" />
    <add key="SOAPServicesSSLEnabled" value="false" />
    <add key="ODataServicesSSLEnabled" value="false" />
    <add key="PublicODataBaseUrl" value="" />
    <add key="PublicSOAPBaseUrl" value="" />
    <add key="PublicWebBaseUrl" value="" />
    <add key="PublicWinBaseUrl" value="" />
    <add key="DefaultClient" value="Windows" />
    <add key="ServicesOptionFormat" value="OptionCaption" />
    <add key="ServicesLanguage" value="en-US" />
    <add key="SOAPServicesMaxMsgSize" value="1024" />
    <add key="ServicesUseNTLMAuthentication" value="false" />
    <add key="ServicesDefaultTimeZone" value="UTC" />
    <add key="ServicesDefaultCompany" value="" />
    <add key="ODataServicesMaxPageSize" value="1000" />
    <add key="ClientServicesOperationTimeout" value="MaxValue" />
    <add key="ClientServicesProtectionLevel" value="EncryptAndSign" />
    <add key="MaxConcurrentCalls" value="1000" />
    <add key="ClientServicesMaxConcurrentConnections" value="500" />
    <add key="ClientServicesReconnectPeriod" value="00:10:00" />
    <add key="ClientServicesMaxNumberOfOrphanedConnections" value="20" />
    <add key="ClientServicesCompressionThreshold" value="64" />
    <add key="MetadataProviderCacheSize" value="150" />
    <add key="ClientServicesMaxUploadSize" value="30" />
    <add key="EnableDebugging" value="false" />
    <add key="DebuggingAllowed" value="true" />
    <add key="ClientServicesMaxItemsInObjectGraph" value="512" />
    <add key="ClientServicesChunkSize" value="28" />
    <add key="ClientServicesProhibitedFileTypes" value="ade;adp;app;asp;bas;bat;chm;cmd;com;cpl;csh;exe;fxp;gadget;hlp;hta;inf;ins;isp;its;js;jse;ksh;lnk;mad;maf;mag;mam;maq;mar;mas;mat;mau;mav;maw;mda;mdb;mde;mdt;mdw;mdz;msc;msi;msp;mst;ops;pcd;pif;prf;prg;pst;reg;scf;scr;sct;shb;shs;url;vb;vbe;vbs;vsmacros;vss;vst;vsw;ws;wsc;wsf;wsh" />
    <add key="NASServicesStartupCodeunit" value="1" />
    <add key="NASServicesRunWithAdminRights" value="True" />
    <add key="EnableDeadlockMonitoring" value="true" />
    <add key="NASServicesStartupMethod" value="" />
    <add key="NASServicesStartupArgument" value="" />
    <add key="NASServicesEnableDebugging" value="True" />
    <add key="ClientServicesCredentialType" value="Windows" />
    <add key="UIElementRemovalOption" value="LicenseFileAndUserPermissions" />
    <add key="ClientServicesTokenSigningKey" value="" />
    <add key="ClientServicesFederationMetadataLocation" value="" />
    <add key="ServicesCertificateThumbprint" value="" />
    <add key="ServicesCertificateValidationEnabled" value="true" />
    <add key="EnableSoftwareQualityMetrics" value="false" />
    <add key="DataCacheSize" value="9" />
    <add key="SessionEventTableRetainPeriod" value="3" />
    <add key="SqlCommandTimeout" value="00:30:00" />
    <add key="BufferedInsertEnabled" value="true" />
    <add key="DisableSmartSql" value="false" />
    <add key="DocumentServicesProvider" value="SHAREPOINTONLINE" />
    <add key="EnableFullALFunctionTracing" value="false" />
    <add key="Multitenant" value="false" />
    <add key="CloseInactiveSqlConnectionsGeneration" value="10" />
    <add key="EnableALServerFileAccess" value="true" />
    <add key="EnableApplicationChannelLog" value="true" />
    <add key="EncryptionProvider" value="LocalKeyFile" />
    <add key="ExchangeAuthenticationMetadataLocation" value="" />
    <add key="AppIdUri" value="" />
    <add key="WSFederationLoginEndpoint" value="" />
    <add key="AzureActiveDirectoryClientId" value="" />
    <add key="AzureActiveDirectoryClientSecret" value="" />
    <add key="AzureActiveDirectoryClientCertificateThumbprint" value="" />
    <add key="EnableMembershipEntitlement" value="" />
    <add key="MaxRowsToExportToExcel" value="MaxValue" />
    <add key="EnableTaskScheduler" value="true" />
    <add key="TaskSchedulerMaximumConcurrentRunningTasks" value="10" />
    <add key="ClientServicesKeepAliveInterval" value="00:02:00" />
    <add key="UseSimplifiedFilters" value="false" />
    <add key="ExcelAddInAzureActiveDirectoryClientId" value="" />
    <add key="DisableWriteInsideTryFunctions" value="true" />
    <add key="ExtendedSecurityTokenLifetime" value="0" />
    <add key="MaxStreamReadSize" value="1000000" />
    <add key="EnableStaticAssemblies" value="False" />
    <add key="EnableThreadThrottling" value="True" />
    <add key="EnablePreScaledMedia" value="True" />
    <add key="ClientServicesIdleClientTimeout" value="MaxValue" />
    <add key="OrphanedConnectionPurgePeriod" value="00:01:00" />
    <add key="Binding" value="" />
    <add key="ODataEnableExcelAddInAnnotations" value="True" />
    <add key="AcsAuthenticationUrl" value="" />
    <add key="AppProtocolName" value="ms-dynamicsnav" />
    <add key="AzureActiveDirectoryClientApplicationId " value="00000000-0000-0000-0000-000000000000" />
    <add key="DefaultLanguageId" value="1033" />
    <add key="UseQueryForFind" value="False" />
    <add key="SqlParametersByOrdinal" value="True" />
    <add key="SqlConnectionTimeout" value="0:01:30" />
    <add key="SqlLongRunningThreshold" value="1000" />
    <add key="SqlBulkImportBatchSize" value="400" />
    <add key="SessionEventTablePurgeLookupPeriod" value="24:00:00" />
    <add key="CacheSynchronizationPeriod" value="0:00:30" />
    <add key="HeartbeatPeriod" value="0:00:30" />
    <add key="TaskSchedulerPeriod" value="0:00:02" />
    <add key="ResultSetGroupCacheUsesGlobalCache" value="True" />
    <add key="UseCalculatedFieldsCache" value="True" />
    <add key="UseResultSetCache" value="True" />
    <add key="EnableTempTableSizeReporting" value="False" />
    <add key="ClientBuildRestriction" value="WarnClient" />
    <add key="DisableDataCache" value="False" />
    <add key="WildcardEvaluationTimeout" value="0:00:05" />
    <add key="EnableODataStrictFiltering" value="True" />
    <add key="TraceLevel" value="Normal" />
    <add key="AzureKeyVaultClientId" value="00000000-0000-0000-0000-000000000000" />
    <add key="AzureKeyVaultClientCertificateStoreLocation" value="LocalMachine" />
    <add key="AzureKeyVaultClientCertificateStoreName" value="My" />
    <add key="AzureKeyVaultClientCertificateThumbprint" value="" />
    <add key="AzureKeyVaultKeyUri" value="" />
    <add key="TokenAuthorityEndpoint" value="" />
    <add key="GraphApiEndpoint" value="" />
    <add key="EnableTenantLicenseStateCheck" value="False" />
    <add key="EnableDataExportImport" value="True" />
    <add key="TenantDetectionMaxRetryCount" value="12" />
    <add key="TenantMaxPollCountPerCycle" value="10" />
    <add key="FeatureSwitchOverrides" value="" />
    <add key="ExtensionsUsageReportingInterval" value="0:15:00" />
    </appSettings>
  • EvgenyEvgeny Posts: 7Member
    I noticed such a thing. First stop NavBatch. Then restart the task in the queue in navision, and I receive the following error message:

    Server instance: DynamicsNAV100
    Category: TaskScheduling
    ...
    EventTime: 11/12/2017 15:57:00
    Message <ii>(PrincipalServerDownException): <ii>The server could not be contacted.

    But the service DynamicsNAV100 is not configured as NAS Service !
  • JuhlJuhl Posts: 507Member
    Sure you have disabled Task Scheduler on primary instance?
    Follow me on my blog juhl.blog
  • EvgenyEvgeny Posts: 7Member
    Absolutely. Now expand the domain controller and AD.
  • martinjordtmartinjordt Posts: 14Member
    Hi Evgeny,
    Were you able to solve the problem?
    I'm facing the exact same challenge. My problems started after installing a new SQL server on the machine and re-mounting the database to the new SQL server. Funny enough - every new database I have created, with the exact same permission settings on SQL does not have the problem. It's ONLY the old database no matter if I restore from a backup, or if I simply re-mount the DB.
    Breg
    Martin
  • We are have a problem with the Task Scheduler as well but are getting a different message, which I have determined to be a problem with the FindByIdentity .NET function as described here:

    https://blogs.msdn.microsoft.com/dsadsi/2009/08/28/getting-an-exception-the-specified-directory-service-attribute-or-value-does-not-exist-when-you-try-to-search-a-user-in-an-ad-container-using-system-directoryservices-accountmanagement/

    In some cases, the FindByIdentity function requires the FDQN (Fully Qualified Domain Name) in order to get a login. We have seen this happen only on our Azure systems where the login has multiple formats [email protected] or DOMAIN\eric_silverw.com (although the format used doesn't matter). Even though the stack from the Windows Event Log is different in the case in the post, I suspect it is the same underlying problem.

    I have a support case open with Microsoft to resolve this but in the meantime, I have setup the Windows Task scheduler in combination with Powershell to run scheduled tasks.

    Also, if anyone is interested, I have a .NET test application that can recreate/demonstrate the problem.
  • alhalh Posts: 3Member
    Hi all,

    CU13 resolves the problem (testet!!).
  • alhalh Posts: 3Member
    Hi all again,

    sorry, CU13 resolves this problem only on my testmachine (not in a Domain), but not in the domain.
  • alhalh Posts: 3Member
    Now I have CU08 installed.
    The Jobscheduler runs without problems.
  • martinjordtmartinjordt Posts: 14Member
    Upgraded to NAV2018 - problem solved!
    ...all sorts of new problems though, but that's another story...
Sign In or Register to comment.