Implement quartz.net through configuration - quartz.net

I need to shedule some task through the Quartz.net. I want to configure the trigger and jobdetails through the config file. Is there any way?

It seems that the configuration and/or implementation has changed in Quartz 2. You will have to include this in your config:
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz"/>
in addition to your other configuration settings in the <quartz> node. Hope this helps.

You can use XMLSchedulingDataProcessorPlugin:
This plugin loads XML file(s) to add jobs and schedule them with triggers as the scheduler is initialized, and can optionally periodically scan the file for changes.

if you not have a XML or Config only for the job then remove all keys with value Quartz.Plugin in the Web Config and set only
<add key="quartz.scheduler.instanceName" value="XmlConfiguredInstance" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="5" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

Related

NuGet.Config file Transforms?

Is there a way to transform a Nuget.Config file in a solution based on the solution configuration? I have one packageSource that I only use for resolving dependencies on my local machine. I don't want this packageSource to be used at all when I build the solution on the build server.
<?xml version="1.0" encoding="utf-8"?>
<packageSources>
<clear />
<add key="MyLocalFeed" value="\\MyNetworkShare" />
<add key="CompanyFeed" value="http://companynugetserver/" />
</packageSources>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
In the above sample Nuget.Config, I only want to use "MyLocalFeed" on my local development server ("Debug" configuration in the solution). Once all changes are checked-in and built on the build server, the "MyLocalFeed" packageSource should no longer appear/be ignored. I have to keep the <clear /> statement in the config, per company requirements.
No, we cannot transform a Nuget.Config file in a solution based on the solution configuration.
Based on your description you can use the "MyLocalFeed" for local development, and remove "MyLocalFeed" in the Nuget.Config file and use that file in TFS build to restore the packages from CompanyFeed.
But please note that the local packages may have other dependencies which are not included in CompanyFeed...
So we recommend using the same NuGet feed for development and CI, or you push all the related packages into theCompanyFeed.

Configuring AzureTableStorage Serilog sink from config file

Can the Azure Table Storage sink for Serilog be configured via the app/Web.config like other sinks, eg Elasticsearch and Seq, which can be configured from the configuration files.
The github page for AzureTableStorage sink shows only code based configuration.
Thanks
I was able to figure this out:
<add key="serilog:using" value="Serilog.Sinks.AzureTableStorage" />
<add key="serilog:write-to:AzureTableStorageWithProperties.connectionString" value="DefaultEndpointsProtocol=https;AccountName=someaccount;AccountKey=uJeYNoa/4dKKtH3zG+7YlA==;EndpointSuffix=core.windows.net" />
<add key="serilog:write-to:AzureTableStorageWithProperties.storageTableName" value="my-logs" />
With this, am able to see the logs coming in StorageExplorer

Configuring Serilog to write to Slack via app.config

I've created an application that I want to get logging to Slack for a particular purpose. I've already confirmed that it is working logging to a RollingFile and to Seq. I've added in serilog.sinks.slackclient and the application runs, and logs, but nothing shows up in my Slack channel.
Can someone verify whether there is an issue with my config?
from app.config (obviously xxx, yyy, zzz are substituded for key values.):
<add key="serilog:minimum-level" value="Debug" />
<!--<add key="serilog:using:RollingFile" value="Serilog.Sinks.RollingFile" />-->
<add key="serilog:using:Slack" value="Serilog.Sinks.Slack" />
<add key="serilog:write-to:Slack" value="https://hooks.slack.com/services/xxx/yyy/zzz" />
<add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341/" />
<add key="serilog:write-to:RollingFile.pathFormat" value="C:\Logs\Serilog\Test-{Date}.txt" />
<add key="serilog:write-to:RollingFile.retainedFileCountLimit" value="10" />
The parameter name webhookUrl is missing out of the write-to directive:
<add key="serilog:write-to:Slack.webhookUrl"
value="https://hooks.slack.com/services/xxx/yyy/zzz" />

Browser cache for static contents

I am trying to update the configuration which effects the browser caching settings for static resources (js, css, images).
I have Sitecore CMS site and images uploaded in CMS, these images are cached in browser (status code = 200 (from cache), when i observed the network in Chrome browser), but my other resources like js and css which served from Website folder are not cached in browser, and the status code is 304 (which is server cache and there is a round trip required to check for any update.)
I have below config settings in web.config file:
<caching>
<profiles>
<add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".png" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".json" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
</profiles>
</caching>
<staticContent>
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" />
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
Now if i remove the caching-profiles entry, then the resources are cached in browser, i can see all the css, js status code as 200 (from cache) for the subsequent request.
My question here is, what is the difference here, why browser cache didn't worked even there is a staticContent settings are added. What is the impact if I remove the existing caching-profiles settings (will it impacts server cache?).
I saw some other links, which explains static cache settings, but i want to know the impact with the changes i did (removed caching-profiles)
Please let me know your inputs.
Below are the Response header details:
With caching-profiles:
Without caching-profiles:
Thanks,
Sharath
So, it appears you are configuring IIS output cache for .jpeg, .js, ..., within the web.config system.webServer/caching node (beware, .webServer, not .web).
Unfortunately, IIS output cache (and Asp.Net output cache too by the way) does also handle client caching, and so it interferes (badly) with your client caching settings. (It should be two separate matters in my opinion, but that is not the way IIS/Asp.Net output caches handle it.)
Your profiles do not set the location attribute, so they default to Server. With output cache semantic, this means "no client cache", thus the no-cache it adds in Cache-Control response header.
To avoid this, you may change your profile location to Any.
<profiles>
<add extension=".jpeg" location="Any" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".js" location="Any" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".png" location="Any" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".jpg" location="Any" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".css" location="Any" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".json" location="Any" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
</profiles>
But maybe should you simply not use IIS output-cache for .jpeg, .js, ...
From official IIS documentation:
Output caching is unnecessary for static files, such as HTML, JPG, or GIF files, ...
It has no benefit using IIS output cache for static files. (It may have benefits using an actual cache server such as varnish in front of your IIS, but emulating a cache server with IIS output cache has no benefit for static files.)
If you have some special cases URIs endings with static file extension but actually served dynamically by your application instead of directly corresponding to a file on disk (special case usually involving using rammfar which is a bad thing for application scalability; linked page gives some alternates by the way), better try enabling output-cache only for those URIs, by configuring it under
<configuration>
...
<system.webServer>
... <!-- not here! -->
</system.webServer>
...
<location path="yourDynamicImagesUriBasePath">
<system.webServer>
<caching>
... <!-- move it here -->
(I am not sure it works though, better test it of course.)

TFS2010 TF215097:No Endpoint Listening

Ok I have a TFS2010 Build Controller Setup as follows
I have 3 VM's each running the TFS Build Host Service
1 has 1 controller and 1 agent
2 have 2 Build Agents each.
Most of the time (7\10 builds) it comes back with the following error message
TF215097: An error occurred while initializing a build for build definition BUILD_DEFINITION: There was no endpoint listening at http://MACHINE1:9191/Build/v3.0/Services/Controller/14 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
and there is no errors when i do get this message. the following is the config file that i have created
<configuration>
<appSettings>
<add key="traceWriter" value="true"/>
</appSettings>
<system.diagnostics>
<switches>
<add name="BuildServiceTraceLevel" value="4"/>
<add name="API" value="4"/>
<add name="Authentication" value="4"/>
<add name="Authorization" value="4"/>
<add name="Database" value="4"/>
<add name="General" value="4"/>
<add name="traceLevel" value="4"/>
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" initializeData="c:\logs\TFSBuildServiceHost.exe.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
I do have my own custom activities in my build process but this does not seem to be a problem as sometimes the build actually does go. I have tried refreshing the template as some sites suggest.
Has anyone come across a solution for this problem? or can anyone tell me how to catch these errors when they happen?
This could be an issue with a third-party firewall on your build agents that is not allowing communication from the TFS server. Try disabling any firewalls and see if that resolves your problem.

Resources