How To

How to fix InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager'
By Tan Lee Published on May 11, 2024 4.15K

To resolve the error 'InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager[Microsoft.AspNetCore.Identity.IdentityUser]' has been registered,' follow these steps when customizing ASP.NET Core Identity.

System.InvalidOperationException: Unable to resolve service for type while attempting to activate
By Tan Lee Published on Jan 11, 2025 2.79K

The error System.InvalidOperationException: Unable to resolve service for type while attempting to activate typically occurs in .NET applications when the dependency injection (DI) container is unable to resolve or instantiate a service that is being requested.

Unable to resolve service for type 'Microsoft.AspNetCore.Identity.RoleManager'
By Tan Lee Published on May 31, 2024 1.89K

The error "Unable to resolve service for type 'Microsoft.AspNetCore.Identity.RoleManager'" in ASP.NET Core typically occurs when the dependency injection can't find or inject a required service.

How to take a screenshot with Selenium WebDriver
By Tan Lee Published on Jan 10, 2025 405

Taking screenshots in Selenium WebDriver is a key feature for automated testing, allowing testers to capture visual evidence of issues, bugs, or test failures.

Sending JSON in .NET Core
By Tan Lee Published on Jan 10, 2025 273

In .NET Core, the Microsoft.Azure.Storage.Queue package has been replaced with the Azure.Storage.Queues package, and the CloudQueueMessage you used to send messages via queue.AddMessageAsync() has been simplified into the SendMessageAsync(string) method.

Writing Files Asynchronously with Multiple Threads in .NET Core
By Tan Lee Published on Jan 10, 2025 497

When building applications that need to write to a file from multiple threads, it's crucial to ensure thread safety and avoid race conditions.

Manipulating XML Google Merchant Data with C# and LINQ
By Tan Lee Published on Jan 10, 2025 302

When working with data from the Google Merchant Center, you often receive a Google Product Feed, typically in XML format, containing product information.

Set Local Folder for .NET Core in C#
By Tan Lee Published on Jan 10, 2025 275

When developing a .NET Core Worker Service, you can configure the service to run as a Windows Service using the following code.

Solr Search in .NET Core
By Tan Lee Published on Jan 10, 2025 630

.NET Core offers robust support for interacting with the Solr search engine.

Handling 415 Unsupported Media Type in .NET Core API
By Tan Lee Published on Jan 10, 2025 1.26K

In .NET Core APIs, the default content type for incoming requests is application/json.

HttpClient Follow 302 Redirects in .NET Core
By Tan Lee Published on Jan 10, 2025 408

In .NET Core, the HttpClient class does not automatically follow HTTP redirects, including 302 (Found) and 301 (Moved Permanently) responses.

Accessing Users from IdentityServer in .NET Core
By Tan Lee Published on Jan 10, 2025 197

If you ever find yourself needing to directly access the IdentityServer users database, you might notice that the API can feel somewhat awkward.