web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Company focused web service call causes "There is no Active Session within the filter" error

(0) ShareShare
ReportReport
Posted on by 55

Dear All,

I am working on integration with NAV via OData/SOAP. My .NET app using autogenerated clients. Everything is ok with system services (http://myNav.com:7047/MyNavServer/WS/SystemService or http://myNav.com:7048/MyNavServer/OData requesting "Company" entity), but when I am trying to call something company related (e.g. http://myNav.com:7048/MyNavServer/OData/Company('MyComp')) several times, only the first call is successful, second throws an exception

System.Data.Services.Client.DataServiceQueryException : An error occurred while processing this request.
  ----> System.Data.Services.Client.DataServiceClientException : <?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code /><m:message xml:lang="en-US">There is no Active Session within the filter.&#xD;
&#xD;
Filters: Server Instance ID: 1029, Session ID: 434</m:message></m:error>
   at System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext context, QueryComponents queryComponents)
   at System.Data.Services.Client.DataServiceQuery`1.Execute()
   at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray(IEnumerable`1 source)
   at CRM.DevX.Tests.Integration.Nav.Odata.CompanyInformationClientTests.CompanyInformationService_SingleRequest(String companyName) in CompanyInformationClientTests.cs: line 16
   at CRM.DevX.Tests.Integration.Nav.Odata.CompanyInformationClientTests.CompanyInformationService_MultipleSequentalRequests_UsingPersonalClients(String companyName) in CompanyInformationClientTests.cs: line 28
--DataServiceClientException
   at System.Data.Services.Client.QueryResult.ExecuteQuery()
   at System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext context, QueryComponents queryComponents)

Several requests made sequentially are possible only if there is a 15-20 sec delay between them. I've tried using same client instance for all the requests and separate for every request, same exception.
 The same situation with SOAP services.
What I am doing in a wrong way. Please help.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rashed Profile Picture
    3,765 on at

    You probably have code in NAV that searches for the current session.  Change the code not to use the table.  The code is probably looking for the computer name etc.  Have those as setup in a different table.

  • Anatoliy E Profile Picture
    55 on at

    Thanks Rashed!

    I didn't have any experience in Nav, C/AL development. Where should I start to look from? Some kind of event "OnWebServiceRequest" in codeUnit?

  • Anatoliy E Profile Picture
    55 on at

    Also I noticed NAV leaves session after my request to service processed. And the session id is negative. Is it ok?

  • Verified answer
    Anatoliy E Profile Picture
    55 on at

    As Rashed mentioned the problem is in code that queries Active Session table.

    OnAfterGetRecord trigger of Company Information page runs following code when System Indicator is "Company + Database" :

    ActiveSession.SETRANGE("Session ID",SESSIONID);

    ActiveSession.FINDFIRST;

    The code causes error.

    At Company Information page edit form I've changed System Indicator field value from "Company + Database" to "Company".

  • Community Member Profile Picture
    on at

    I am getting the same error. I tired out changing Company+Database to company still not resolved. Any suggestions? Here is the full stack trace "Server instance: LIVE

    Tenant ID:

    User:

    Type: Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideDataException

    Remappable: True

    ErrorCode: 18023495

    ErrorNumber: 1095

    ModuleNumber: 19

    SuppressMessage: False

    SuppressExceptionCreatedEvent: False

    FatalityScope: None

    Message:

     There is no Active Session within the filter.

     Filters: Server Instance ID: 1136, Session ID: 10

    StackTrace:

        at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.CallEventSubscriber(NavEventSubscription subscriber, NavCodeunit subscriberCodeunitInstance, Object[] parameters)

        at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.ProcessCallToAllSubscribers(NavApplicationObjectBase callerApplicationObject, PrepareParametersCallBack prepareParameters)

        at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.OnRunEvent()

        at Filter.InvokeWithFilter(NavMethodScope )

        at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit1.OnAfterCompanyOpen() in c:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Server\MicrosoftDynamicsNavServer$LIVE\radsource\Codeunit1_37.cs:line 1058

        at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit1.CompanyOpen_Scope.OnRun() in c:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Server\MicrosoftDynamicsNavServer$LIVE\radsource\Codeunit1_37.cs:line 1278

        at Filter.InvokeWithFilter(NavMethodScope )

        at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

        at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit1.CompanyOpen() in c:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Server\MicrosoftDynamicsNavServer$LIVE\radsource\Codeunit1_37.cs:line 682

        at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit1.OnInvoke(Int32 memberId, Object[] args) in c:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Server\MicrosoftDynamicsNavServer$LIVE\radsource\Codeunit1_37.cs:line 97

        at Microsoft.Dynamics.Nav.Runtime.NavCodeunit1.Invoke(Int32 methodId, Object[] arguments)

        at Microsoft.Dynamics.Nav.Runtime.SessionTransactionManager.TransactionScope(Action code)

        at Microsoft.Dynamics.Nav.Runtime.NavSession.OpenCompany(String companyName, Boolean updateUserPersonalization)

        at Microsoft.Dynamics.Nav.Service.WebServices.ServiceBroker.Invoke(Boolean isSoapMessage, Uri url, XmlReader input, TextWriter output, NavUserAuthentication navUserAuth)

        at Microsoft.Dynamics.Nav.Service.WebServices.NavWebService.<>c__DisplayClass5.<>c__DisplayClass7.<ProcessMessage>b__3()

        at Microsoft.Dynamics.Nav.Service.WebServices.Disposer.Scope(Code code)

        at Microsoft.Dynamics.Nav.Service.WebServices.WCFUtil.GetPopulatedMemoryStream(StreamFillingCallback callback)

        at Microsoft.Dynamics.Nav.Service.WebServices.NavWebService.ProcessMessage(Message message)

        at SyncInvokeProcessMessage(Object , Object[] , Object[] )

        at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)

        at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)

        at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

    Source: Microsoft.Dynamics.Nav.Ncl

    HResult: -2146233088

    "

  • rsaritzky Profile Picture
    on at

    I am getting a similar error when trying a Data upgrade (start-navdataupgrade) from 2015 to 2016:

    Server instance: DynamicsNAVCCBDEV2016

    Tenant ID:

    User:

    Type: Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideDataException

    Remappable: True

    ErrorCode: 18023495

    ErrorNumber: 1095

    ModuleNumber: 19

    SuppressMessage: False

    SuppressExceptionCreatedEvent: False

    FatalityScope: None

    Message:

     There is no Active Session within the filter.

     Filters: Server Instance ID: 16, Session ID: 42

    StackTrace:

        at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.CallEventSubscriber(NavEventSubscription subscriber, NavCodeunit subscriberCodeunitInstance, Object[] parameters)

        at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.ProcessCallToAllSubscribers(NavApplicationObjectBase callerApplicationObject, PrepareParametersCallBack prepareParameters)

        at Filter.InvokeWithFilter(NavMethodScope )

        at Filter.InvokeWithFilter(NavMethodScope )

        at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit1.OnInvoke(Int32 memberId, Object[] args)

        at Microsoft.Dynamics.Nav.Runtime.NavCodeunit1.Invoke(Int32 methodId, Object[] arguments)

        at Microsoft.Dynamics.Nav.Runtime.SessionTransactionManager.TransactionScope(Action code)

        at Microsoft.Dynamics.Nav.Runtime.NavSession.OpenCompany(String companyName, Boolean updateUserPersonalization)

        at Microsoft.Dynamics.Nav.Runtime.NavUpgradeCodeunit.InvokeCodeunitMethod(String methodName, String companyName, Object[] args)

        at Microsoft.Dynamics.Nav.Runtime.NavExecuteUpgradeCodeunitMethodActivity.RunUpgradeMethod(NavSession navSession)

        at Microsoft.Dynamics.Nav.Runtime.NavExecuteUpgradeCodeunitMethodActivity.<ExecuteAsync>b__5(NavSession navSession)

        at Microsoft.Dynamics.Nav.Runtime.NavWorkflowTenantSessionManager.Microsoft.Dynamics.Nav.Runtime.INavWorkflowTenantSessionManager.RunActionInSystemSession(Action`1 action)

        at Microsoft.Dynamics.Nav.Runtime.NavExecuteUpgradeCodeunitMethodActivity.ExecuteAsync()

        at System.Threading.Tasks.Task.Execute()

    Source: Microsoft.Dynamics.Nav.Ncl

    HResult: -2146233088

    Anyone see this before?

    Ron

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans