We have created a custom timer job in VS2012 farm project.
The scope is set to Site level and the project is deployed at GAC.
Using VS2012, we can deploy the project and see it come up in the Job Definitions, we can hit RUN NOW and the timer job gets executed (it adds an item to a list).
However, when we package and install & activate the same project using PowerShell and hit RUN NOW nothing happens (time job does not execute). If we attach debugger to OWSTimer and then hit RUN NOW, then the timer job gets executed. What is happening? Why is it working only when we use VS and attach debugger to OWSTimer.exe?
We have logged in to the site and installed the package (PowerShell) using farm admin account.
Foll. is my PoweraShell script: (run as admin)
$oUrl="http://mysite:7676/" $solutionPath="C:\soln\" $solution="sampletimer.wsp" $path= $solutionPath + $solution Add-SPSolution -LiteralPath $path install-spsolution -Identity $solution -GACDeployment -Confirm:$true Enable-spfeature -identity "sampletimer_MyTimerJobFeatureEventReceiver" -confirm:$false -url $oURL
Our timer job is set to scope of SITE, we have packaged the wsp and installed & activated via PowerShell. Then, if we click on RUN NOW then it just wont execute its program (it is supposed to insert an item into a list). However, if we attached VS debugger to OWSTimer.exe, then hit RUN NOW, the timer job code gets executed and list items appears.
This is very confusing as to why SharePoint is behaving like this.. What must be causing this?