Options

NAS getting stuck when ran as service

rrvanzylrrvanzyl Member Posts: 21
I am experiencing a rather odd problem with NAS.
I developed a solution to queue reports to be printed as pdf (by BullZip) and then sent through NAS by email as attachments.

Environment is NAV2009 R2 SQL Client, running on SQL2005.

The Email hander code unit is SingleInstance = YES, and has the Navision Timer enabled to trigger every 60 seconds.
When I run the NAS connection through debug, the process executes as expected, ie all pdfs are created and sent via SMPT.
When I run NAS through the command prompt, leaving the dialogue box open, the code is still executed perfecctly.
BUT, as soon as I try and execute the handler from the installed service, it is as if the process gets stuck somewhere, never finishing.
There are no messages in the Event viewer.

For NAS, is have created a new local user name also called NAS and it belongs to the Admin group. I have also logged in physically with this new user name to ensure all windows profile settings are created especially for BullZip. The user is setup in NAV with Super permissions. Changing this to another existing account makes no difference.
The license in the App. Server folder is a developer's license.

Any suggestions or assistance would be appreciated, since I am currently stumped... :-k

Comments

  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Very strange...
    rrvanzyl wrote:
    There are no messages in the Event viewer.
    Even no message about the NAS version?
    Application Server for Microsoft Dynamics NAV version 6.00 (Build 32012)
    Copyright (c) 1987-2010 Microsoft Corporation

    Did you have a look at the System folder of the Event Viewer?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    rrvanzylrrvanzyl Member Posts: 21
    I do get the NAS version message in the Event Viewer.
    Application Server for Microsoft Dynamics NAV version 6.00 (Build 32012)
    Copyright (c) 1987-2010 Microsoft Corporation

    What I meant was, there are no errors...

    I am running it now through the command prompt on the server, so far no issues.... but it HAS to word as a service....
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    That means you also get the message about the NAS login, right?
    The Application Server for Microsoft Dynamics NAV NameOfYourNAS started with the following configuration:
    Database Server Name = xxx
    Database = xxx
    Company = xxx
    Startup Parameter = xxx
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    rrvanzylrrvanzyl Member Posts: 21
    Yes, the "successful start-up" message.

    The Application Server for Microsoft Dynamics NAV NAS-SQL started with the following configuration:
    Database Server Name = MONSTER-PC
    Database = Development
    Company = [DEV] Company
    Startup Parameter = EMAILBATCH
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Ok, that means your issue is located somewhere within NAV. Have you checked if there are records that have to be processed in that company?

    Perhaps you could put in some messages to see how far your code is executed.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    rrvanzylrrvanzyl Member Posts: 21
    Yes, my test dataset has 6 records (customers) to process. For testing purposes I have even tried just doing one.
    When I start NAS in debug mode and go through the code, there aren't any issues, the pdf's are created and the mail is sent, the same goes for running NAS from the command prompt.

    Just some further info, I am using Expandit MailIt to attach the pdf's and email via SMTP. Works like a charm...normally.
    I have been wondering if it couldn't be that there isn't enough "sleep" in the code to wait for the pdf to be created, but then, why would it work when running from the command prompt???
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Processing in debug mode is of course somewhat slower than pure NAS. And in command prompt it's also a very little bit slower because the system has to create some output on the screen. But that's only a few milliseconds, so I don't know if that could be an issue. I would give it a try and put some SLEEP commands in.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    rrvanzylrrvanzyl Member Posts: 21
    I agree. Will give it some sleep and see what happens.
    Thanks for your input! Much appreciated!
  • Options
    kinekine Member Posts: 12,562
    We have same issues. In all cases where we have the problem is, that Automation is used in the job running under NAS. Each CREATE of the automation is allocating memory and the memory is not correctly released. It is released only by restarting the service. You can minimize this by creating the automation only once in one singleinstance codeunit and use his single instance everywhere. But still in some cases you need to restart the NAS to preven the freezing..
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    rrvanzylrrvanzyl Member Posts: 21
    kine wrote:
    We have same issues. In all cases where we have the problem is, that Automation is used in the job running under NAS. Each CREATE of the automation is allocating memory and the memory is not correctly released. It is released only by restarting the service. You can minimize this by creating the automation only once in one singleinstance codeunit and use his single instance everywhere. But still in some cases you need to restart the NAS to preven the freezing..

    You are absolutely correct. I have determined that my problem lies with the ExpadIT MailIT OCX control. When NAS running as a service hits the first MailIT statement, it freezes... Now the question is whether it is a NAV bug, or ExpandIT... #-o
  • Options
    kinekine Member Posts: 12,562
    It could be both, but I see the problem with different Automations, it means it is rather NAV problem. But with some it is more often than with other...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    meto89meto89 Member Posts: 10
    I know this topic is quite old, but is there a solution for this problem?

    I have the same problem, except that I am using an excel automation and when I call the function "ExportAsFixedFormat", the NAS (Service) is getting stuck. (Everything else matches rrvanzyl's description.)


    Kind regards,

    Alex
  • Options
    DakkonDakkon Member Posts: 192
    I can't help but wonder if this is an issue of the automation object attempting to create some sort of dialog for the user to interact with. This would run without issue on the client but be a problem under NAS. Of course normally this would result in an error message going into the event log and I know the first poster said there are no messages in the event viewer. Still, for anyone else running into similar issues with automation objects working in the client but not under NAS, I would check to make sure it doesn't attempt to create a dialog at any point.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • Options
    meto89meto89 Member Posts: 10
    Dakkon wrote:
    I can't help but wonder if this is an issue of the automation object attempting to create some sort of dialog for the user to interact with. This would run without issue on the client but be a problem under NAS. Of course normally this would result in an error message going into the event log and I know the first poster said there are no messages in the event viewer. Still, for anyone else running into similar issues with automation objects working in the client but not under NAS, I would check to make sure it doesn't attempt to create a dialog at any point.
    It's not directly the NAS, because if you run the NAS by using the command prompt, everything works fine. Only if you have installed the NAS as a service, then it won't work... =/


    Kind regards,

    Alex
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    We've got exactly the same issue. It works in NAS if it runs in cmd, but it won't if it runs as service. I assume that you use the same user in cmd that is used as service user?!

    We guess that it has something to do with the Windows Profile of the service user. It's probably not fully loaded. At the moment we don't have any explanation why exactly it doesn't work. And it might become even more strange when I tell you that we've had another issue a couple of month ago where we setup something in the user profile of the service user and that works. So, it seems like the user profile is only partially loaded.

    Do you know what your automation exactly wants to do? In our case it gets stuck when it tries to read from the registry.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    meto89meto89 Member Posts: 10
    Hello einsTeIn.NET,

    thanks for the answer so far. To answer your questions:
    I assume that you use the same user in cmd that is used as service user?!
    Indeed.
    Do you know what your automation exactly wants to do? In our case it gets stuck when it tries to read from the registry.
    I get the problem, if I use the function ExportAsFixedFormat from the excel workbook automation. The function should create a PDF document from the current workbook, but I am not really sure what excel does in the process.


    BTW, would you mind telling me, what you changed in the profile?
    [...] where we setup something in the user profile of the service user and that works. So, it seems like the user profile is only partially loaded.

    Kind regards,

    Alex
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    meto89 wrote:
    Do you know what your automation exactly wants to do? In our case it gets stuck when it tries to read from the registry.
    I get the problem, if I use the function ExportAsFixedFormat from the excel workbook automation. The function should create a PDF document from the current workbook, but I am not really sure what excel does in the process.
    Hmmm... create pdf documents?! Is it possible that this function uses some kind of GUI that is only displayed for a very short time?
    meto89 wrote:
    BTW, would you mind telling me, what you changed in the profile?
    [...] where we setup something in the user profile of the service user and that works. So, it seems like the user profile is only partially loaded.
    Yes, we set another proxy in internet options. That information is stored somewhere in the user settings and after we did that the issue disappeared. So, it looks like the user profile of the service user is loaded (or at least parts of it).

    There is an option to allow services to use some kind of profile (http://msdn.microsoft.com/en-us/library/windows/desktop/ms683502(v=vs.85).aspx) but it's restricted to local system accounts which can't be used for NAV. There's a workaround (http://lostechies.com/keithdahlby/2011/08/13/allowing-a-windows-service-to-interact-with-desktop-without-localsystem/) but in my case that didn't work either.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    meto89meto89 Member Posts: 10
    It's finally working for me. The problem for me was that I did not have a "Desktop" folder for the systemprofile. I just needed to create a folder named "Desktop" in this location:
    C:\Windows\SysWOW64\config\systemprofile
    
    Keep in mind that the location depends on your setup and you might need to add the folder in this location instead:
    C:\Windows\System32\config\systemprofile
    
Sign In or Register to comment.