Send email with attachments using MailKit for .NET core
This post is another example of setting up and using MailKit for .NET core to send an email with attachments.
This post is another example of setting up and using MailKit for .NET core to send an email with attachments.
This is part II of the blog post series in which I share some of ways to build and deploy an ASP.NET core application to IIS running on a Windows VM. In the previous post, I cover how to build and published an ASP.NET core application. The end result is an artifact (a published directory). In this post, I go over how to deploy the artifact to IIS. Along the way, we’ll discuss:
This is part I of the blog post series in which I share some of the ways I have learned to build and deploy an ASP.NET core 2 application to IIS running on Windows Server VM.
In this post, we’ll cover just the basics of how to build and publish an ASP.NET core 2 application to a folder using Visual Studio 2017. In the process, we’ll discuss some of the concepts you should be familiar with:
I assume you have a working ASP.NET core application which you want to deploy. If not, you can just create a new ASP.NET core project, following the documentation.
I have seen applications which use a database to simulate a queue as part of processing some workflow tasks. Using a database to simulate a messaging queue mean you have to write more boilerplate codes, sql queries for the CRUD operations as well as handle concurrency issues if your applications run on multiple nodes.
Microsoft has made it easy to utilize messaging and queueing in your application with azure queue storage, which is what I talk about in this post.
In this post, I talk about Delegate, Func, Action, anonymous methods and lambda expressions in C# and how they help with making the codes more concise and generic.
Sometimes, I have seen developers (myself included) use simple strings to represent dates. This could lead to unexpected behaviors if you are not careful. For instance, I recently ran into a bug where the PDF document the program generated show the incorrect date, which was a few hours off from the correct one. The date value originated from a data API and did not include a timezone. The intended time zone was local time, which is Pacific Standard Time (PST) in this case. However, because we were using storing the date in the angular application using string instead of the javascript built-in Date type, when the framework serialized the data into JSON and sent to .NET, it kept the date as is and did not add any timezone. At the backend, .NET deserialized the value back into a DateTime object, and when we attempted to convert the value to local time usingDateTime.ToLocalTime()
for displaying in the document, we got an incorrect value because .NET assumed the date was in Universal Coordinated Time (UTC).
The bug was because of inconsistencies when passing date values and not including timezone information. However, had we used the frameworks’ built-in types for representing dates instead of strings, we could have avoided the issue.
iTextSharp is a popular library for working with PDF files. The unofficial port of the v4.16 is available for .NET core. In this post, I show examples of using the library to programmatically read and fill out a PDF form.
In this post, I share some bits I have learned about the async/await pattern. Specifically, I discuss some of the pitfalls of using async void in non event handlers.
I have an ASP.NET core web application which hosts a background task via the IHosedService interface. I wrote about it in this post, if you want more info. The task needs to run continuously to poll for messages on an azure queue storage every 5 seconds. I have learned the default settings on IIS do not start the application until it receives the first request. Additionally, if the application has not received a request after a predefined period of time, IIS kills the application.
I could have hosted the application as a Windows service or converted the application into a console application and use the Windows scheduler to have it run continuously. However, I find hosting on a real IIS server convenient and beneficial since we already have other applications running on IIS and we can access the application via HTTP.
In this post, I share how I make the application to auto start and always run on IIS.
If you have an ASP.NET or an ASP.NET core which hosts a background job that needs to always run, want to preload the application for performance instead of waiting for the initial request to hit the app, or just get some tips on IIS, then read on.
In this post, I discuss the features of Azure Active Directory B2B (AAD B2B) and Azure Active Directory B2C (AAD B2C), the differences between them and when to use one vs the other.