Quantcast
Channel: briancaos – Brian Pedersen's Sitecore and .NET Blog
Browsing all 276 articles
Browse latest View live

Application Insights not working in .NET Core Console Application – Remember...

My .NET Core console application did not write to my Application Insights instance. Well, it did, but only sometimes. Writing to Application Insights is done asynchronously, usually every 30 seconds or...

View Article


Image may be NSFW.
Clik here to view.

C# Get expiry timestamp from JWT token

JWT tokens (or Json Web Tokens) are an open-standard the defines a way to transmit information between 2 parties in a secure manner. Identity Server 4 uses JWT as a security token. These tokens have an...

View Article


Image may be NSFW.
Clik here to view.

Sync Sitecore content to external database

The legal department of the client requested that we sync parts of the Sitecore tree to an external, system-versioned temporal table, so that we have a full audit trail of changes to these items...

View Article

Image may be NSFW.
Clik here to view.

System.DllNotFoundException: Unable to load DLL ‘sni.dll’ or one of its...

This message happens when deploying my .NET Core 3.1 application to production (when compiling the code to an .exe file), but not when running the application locally. It turns out, that Dapper is...

View Article

.NET Core Worker Services with Application Insights and Serilog

The .NET Core Worker service is yet another tool in the .NET toolbox. They are perfect for background processing like reading from a queue or making health checks. They are cross-platform (of course)...

View Article


HttpClient retry mechanism with .NET Core, Polly and IHttpClientFactory

A lot of HttpClient errors are temporary and is caused by server overload, temporary nerwork timeouts and generic gliches in the Matrix. These scenarios can be dealt with using a retry pattern. In .NET...

View Article

Remove duplicates from XML feed

Apparently XML isn’t dead yet, and today I received a Google Product Feed in the RSS 2.0 XML format. The feed was full of duplicates and my job is to remove them: <?xml version="1.0"...

View Article

Image may be NSFW.
Clik here to view.

Sitecore high memory usage – not always a problem

Sitecore is known to be a real memory hog. Especially the CM server is known to love memory. One of the memory issues that Sitecore faces is the high usage of the Large Object Heap. Heap Fragmentation...

View Article


Sitecore Memory Issues – Every memory optimization trick in the book

My recent post, Sitecore high memory usage – not always a problem, claims that high memory usage is not the same as having a memory problem in Sitecore. But the reason you are reading this blog is...

View Article


Image may be NSFW.
Clik here to view.

C# Azure TelemetryClient will leak memory if not implemented as a singleton

I noticed that my classic .net web application would leak memory after I implemented metrics for some background tasks. Memory usage of web application Further investigation showed that my...

View Article

Manipulating XML Google Merchant Data using C# and LINQ

Receiving a Google Merchant Data feed (also known as a Google Product Feed) can be fairly easily manipulated on import time using a little C# and LINQ. The feed is basically a XML RSS 2.0 feed with...

View Article

C# Set local folder for .net Core Windows Services

When developing .NET Core Worker Services, you can allow the service to run as Windows Service: public static IHostBuilder CreateHostBuilder(string[] args) { var host = Host.CreateDefaultBuilder(args);...

View Article

Image may be NSFW.
Clik here to view.

Method not found: ‘Void...

I struggled with this error in my development environment: Method not found: ‘Void Sitecore.ContentSearch.Diagnostics.AbstractLog.SingleWarn(System.String, System.Exception)’. at...

View Article


Image may be NSFW.
Clik here to view.

Sitecore field level Security – give write access to members of a certain group

The Sitecore security model is pretty straight forward, but as everything security, it can become complicated. This goes for field level security. For a certain field, I wish to grant read access to...

View Article

Image may be NSFW.
Clik here to view.

Using full Lucene Query Syntax in Azure Search

The Azure Cognitive Search is the search engine in Microsoft Azure. You can search using a simple queries (default) which is good at doing full text searches, or you can use full syntax which is a...

View Article


Run tasks in parallel using .NET Core, C# and async coding

If you have several tasks that can be run in parallel, but still need to wait for all the tasks to end, you can easily achieve this using the Task.WhenAll() method in .NET Core. Imagine you have this...

View Article

Image may be NSFW.
Clik here to view.

Sitecore Publish item when moved or dragged using uiMoveItems and...

Sometimes you have items that needs to be published immediately if moved to a new location in the content tree. Sitecore supports this – of course – via the uiMoveItems and uiDragItemTo pipelines. Move...

View Article


Sending JSON with .NET Core QueueClient.SendMessageAsync

In .NET Core, Microsoft.Azure.Storage.Queue have been replaced with Azure.Storage.Queues, and the CloudQueueMessage that you added using queue.AddMessageAsync() have been replaced with the simpler...

View Article

Add a UserAgent to the IHttpClientFactory in .NET Core

Using a IHttpClientFactory to create HttpClient connections have a number of advantages, as you can configure several httpclients on startup. Each client will be reused, including the properties...

View Article

Image may be NSFW.
Clik here to view.

Filtering Application Insights telemetry using a ITelemetryProcessor

Application Insights is a wonderful tool. Especially when you have a microservice or multi-application environment and you need one place for all the logs and metrics. But it’s not free, and the costs...

View Article
Browsing all 276 articles
Browse latest View live