Page 1 of 1

Help with Plugin with Schedule

PostPosted: Mon Feb 15, 2016 5:48 pm
by marcosomizu
Hi,

I have created a plugin responsible for doing things that should be scheduled.

The code behind the plugin works fine. The problem is, even scheduling the plugin, nothing happens after minutes.

I am putting my plugin attached, and here is my JiwaPluginSchedulerService.exe.config:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="Settings" type="JiwaFinancials.Jiwa.JiwaPluginSchedulerService.Configuration.ConfigurationHandler,JiwaPluginSchedulerService" />
  </configSections>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
    </startup>
  <Settings>
    <PollInterval>60000</PollInterval>
    <Databases>
      <Database>
        <DatabaseName>FPTest</DatabaseName>
        <ServerName>GREG-HP\SQLEXPRESS</ServerName>
        <JiwaUsername>Admin</JiwaUsername>
        <JiwaPassword>password</JiwaPassword>
      </Database>
    </Databases>
  </Settings>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>


PS: The Stored Procedure doesn't do nothing special, it just gets all the parameters from the database.

Could someone help me with this?

Cheers

Re: Help with Plugin with Schedule  Topic is solved

PostPosted: Fri Feb 19, 2016 9:32 pm
by Mike.Sheen
Add some logging to the event log in your plugin code to see if anything is being executed.

Take a look at the "File Watcher" plugin to see how to log to the event log, and put some logging in the service start and execute events.

Wrap your service start and execute in a try catch, and log to the event log inside the catch the exception message.

Try configuring the service to run as a user account to see if it behaves different. Some actions can't be performed by non-user accounts (such as display interactions such as message boxes or form dialog displays), so this may be the the cause.

Let us know the outcome!

Mike

Re: Help with Plugin with Schedule

PostPosted: Thu Feb 25, 2016 12:49 pm
by marcosomizu
Hi Mike,

After a few debugging and logging I was able to do what I wanted. I appreciate your help.

What I've noticed though is that I could only "fire" the Execute event in a Windows Server desktop, but not my computer (Win7). Once I start the scheduler, it stays with the "Started" status, but it doesn't change to "Running", whereas when I updated the plugin in a Windows Server, it ran normally. Does it makes sense or it is just a misinterpretation?

Cheers