Author

ASP.NET 6 Web API

Create New Project Template: ASP.NET Core Web API Framework: .NET 6.0 Check “Configure for HTTPS“ Check “Use controllers (uncheck to use minimal API)” for controller vs minimal API Check “Enable OpenAPI support” for Swagger OpenAPI support Book Class Book Controller or … For Delete, pass in object instead of id. BookController using Entity Framework Example:

CRUD with a .NET 6 Web API & Entity Framework Core Example

Visual Studio 2022 New Project Template: ASP.NET Core Web API Framework: .NET 6.0 Check “Configure for HTTPS“ Check “Use controllers (uncheck to use minimal API)” for controller vs minimal API Check “Enable OpenAPI support” for Swagger OpenAPI support Entity Framework Install the following from Nuget Package Manager… Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore.SqlServer PM> dotnet tool install –global... » read more

Login failed due to trigger execution

Error: Login failed for login <Login Name> due to trigger execution. Changed database context to ‘master’. Changed language setting to us_english. (Microsoft SQL Server, Error: 17892) Resolution: Search for the trigger via: If you see a server level trigger that might be responsible for the login issues, then you can drop it with: Instead of... » read more

Temporal System-Versioned Table

Temporal tables (also known as system-versioned temporal tables) are a database feature that brings built-in support for providing information about data stored in the table at any point in time, rather than only the data that is correct at the current moment in time. Example: Employee (System-Versioned) Sources: https://docs.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables?view=sql-server-ver15

Minimal APIs Demo using .NET6 , EFCore6 and Sql Server

Article: https://medium.com/geekculture/minimal-apis-in-net-6-a-complete-guide-beginners-advanced-fd64f4da07f5 Source Code Example: https://github.com/csehammad/MinimalAPIDemo/ Live Example: https://minimalapidemo.azurewebsites.net/swagger/index.html DB Script: Create a new database and run the script located at /DB/AuthorsDB_Script.sql Live Demo: https://minimalapidemo.azurewebsites.net/swagger/index.html This project demonstrates the following: How to create a CRUD APIs in .NET6 using Minimal APIS. How to add OpenAPI Specifications using Swagger How to Secure Minimal APIs using JWT Authentication

Access to fetch at ‘xxxxx’ from origin ‘xxxxxxx’ has been blocked by CORS policy for Azure Function App

Error: Access to fetch at ‘xxxxx’ from origin ‘xxxxxxx’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled. Issue: Cross-Origin... » read more

Generate Logs for Microsoft Support Troubleshooting for AlwaysOn

Please open the below link https://aka.ms/getTSS 2. Copy the zip file to the Server 3. Unzip the contents of tss_tools.zip to a folder 4. Open PowerShell as Administrator 5. Change to the directory where the files were extracted 6. Run the following command: .\get-psSDP.ps1 Cluster In case if this command does not work please try .\tss... » read more

Unable to access availability database ‘xxxxxxx’ because the database replica is not in the PRIMARY or SECONDARY role.

Error: Cluster Log: Cluster resource ‘xxxxxx’ of type ‘SQL Server Availability Group’ in clustered role ‘xxxx’ failed. Based on the failure policies for the resource and role, the cluster service may try to bring the resource online on this node or move the group to another node of the cluster and then restart it.  Check... » read more

Failed to designate the local availability replica of availability group as the primary replica, unable to start role.

Error: Cannot bring the Windows Server Failover Clustering (WSFC) resource (ID ‘xxxxxxxxxxxxx’) online (Error code 5942). The WSFC service may not be running or may not be accessible in its current state, or the WSFC resource may not be in a state that could accept the request. For information about this error code, see “System... » read more