Configuring Azure app services logging for ASP.Net Core application

If you are using Azure to host your ASP.Net Core website and don’t want to spend time configuring logging in your web application, then you can use Azure App services logging. Here are the changes that you need to make in your web application to configure logging.


using Microsoft.Extensions.Logging.AzureAppServices;
public class Startup
public void ConfigureServices(IServiceCollection services)
} }


"AzureAppServicesLogging": {
"BlobName": "Log.txt"

I have also turned Detailed error messages on, so I can more glean more details if an error occurs.



Continue Reading

“Client with IP address is not allowed to access the server” when running update-database command through Visual Studio.

If you are deploying your entity framework database changes to your production database through Visual Studio(like we do) for the first time,  you might receive the following error:

Cannot open server '<ServerName>' requested by the login. 
Client with IP address '<MyIPAddress>' is not allowed to access the server.  
To enable access, use the Windows Azure Management Portal or 
run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  
It may take up to five minutes for this change to take effect.

To fix this issue, you need to go to your database in the azure portal, click “Set server Firewall” and then add your IP address under “Add Client IP”

2019-04-30 23_10_11-SimplerProductsScrubber_db - Microsoft Azure


Continue Reading

List all AWS resources

I was being charged for AWS resources that I had forgotten to delete. Deleting these resources by going to each region is a big hassle.
The best way that I found to list all AWS resources(short of using a github tool) across all regions is to use the Tag Editor. When searching, select all the regions and all the resource types.  You can then use a link to go to each resource and then delete it, if appropriate.


Continue Reading

Send emails using SendGrid Email provider and ASP.Net Core

Sending emails using SendGrid email provider and ASP.Net Core is very straightforward.
Firstly install SendGrid package through Package Manager Console using the following command

install-package SendGrid

Now create a account in and add an API key to use the SendGrid provider service.  Add this key to your AppSettings.Json or AppSettings.Development.Json under a new SendGridEmailSettings=>SendGridKey node.



"SendGridEmailSettings": {
"SendGridKey": <SendGrid Private API Key>


public void ConfigureServices(IServiceCollection services)
services.AddTransient<IEmailSender, EmailSender>();
services.Configure<AuthMessageSenderOptions>(options =>

EmailSender .cs

using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.Extensions.Options;
using SendGrid;
using SendGrid.Helpers.Mail;
using System.Threading.Tasks;

public class AuthMessageSenderOptions
public string SendGridUser { get; set; }
public string SendGridKey { get; set; }
public class EmailSender : IEmailSender
public EmailSender(IOptions optionsAccessor)
Options = optionsAccessor.Value;
public AuthMessageSenderOptions Options { get; } //set only via Secret Manager
public Task SendEmailAsync(string email, string subject, string message)
return Execute(Options.SendGridKey, subject, message, email);
public Task Execute(string apiKey, string subject, string message, string email)
var sendGridClient = new SendGridClient(apiKey);
var sendGridMessage = new SendGridMessage()
From = new EmailAddress("", "Simpler Products-Social Media Scrubber"),
Subject = subject,
PlainTextContent = message,
HtmlContent = message
sendGridMessage.AddTo(new EmailAddress(email));
// Disable click tracking.See //
sendGridMessage.SetClickTracking(false, false);
return sendGridClient.SendEmailAsync(sendGridMessage);

If you send an email and you do not receive it in your mailbox check the spam folder. My emails landed in the spam folder when I was testing the application.

Continue Reading

NotSupportedException: No IUserTwoFactorTokenProvider named ‘Default’ is registered.

If you have changed the AddDefaultIdentity in the Startup.cs file to AddIdentity and you receive a

An unhandled exception occurred while processing the request.
NotSupportedException: No IUserTwoFactorTokenProvider<TUser> named ‘Default’ is registered.
Microsoft.AspNetCore.Identity.UserManager<TUser>.GenerateUserTokenAsync(TUser user, string tokenProvider, string purpose)

error when registering a user, there is a easy fix. You need to a add a AddDefaultTokenProviders() when adding identity() to services.

public void ConfigureServices(IServiceCollection services)
  services.AddIdentity<User, UserRole>()

Continue Reading

Show\Hide results pane in SQL server management studio

To change keyboard shortcut for show/hide results pane, go to Tools Options in SQL Server Management Studio:

Navigate to Environment > Keyboard > Keyboard.
Search for “Window.ShowResultsPane” using “Show commands containing” textbox.
In the “Press shortcut keys” textbox, press Cntrl + R buttons on the keyboard at the same time.
Click the “Assign” button and then click “OK“.

You might need to restart SQL Server Management Studio to apply these changes.

Continue Reading

Configure website on 000WebHost hosting provider and Google Domains.

Google Domains Configuration:

1: Login into Google Domains account.
Go to “Configure DNS” tab and add, as “custom name servers” as shown below.
Also add a “custom resource record” as below. The “Data” column should be the url of your website on

000WebHost Configuration:

Login into your 000WebHost account. In your website 000webhost panel, go to Set web address -> Add domain.
Enter your domain name and click Park domain

If your nameservers are pointed correctly to 000webhost nameservers, domain will show status Ready which means that is ready to link Website.
Click Manage -> Link website.

Website Admin configuration:
Login into your website \wp-admin. Go to Settings=>General. Update the “WordPress Address URL” and “Site Address URL” to your website’s url.

Continue Reading

Filter network requests when debugging.

When you are debugging, you would like to filter out the various requests so you can concentrate on what’s important eg: filter image or css file requests. Google has finally listened to the developer community and has added support for “negative filters” in Google Chrome-version 42.
Here is the text filter I use when debugging where the “-” sign before each file extension keyword filters the requests. The requests then do not show in the “Network” tab:

-png -svg -aspx -axd -jpg -css -ttf -js -gif -ico -woff2

When you are adding the text filter make sure that the “Regex” checkbox is unchecked.

You can further filter the requests by using the following supported keywords


Continue Reading