Incremental ASP.NET Migration Tooling Preview 2
Last month, we introduced preview tooling to incrementally migrate ASP.NET apps to ASP.NET Core. The tooling comprised two components – a Visual Studio extension that created a new ASP.NET Core app alongside an existing ASP.NET app such that endpoints could be gradually moved from one app to the other, and a library of System.Web adapter APIs allowing code to reference common System.Web APIs while targeting .NET Standard 2.0 and being usable in both ASP.NET and ASP.NET Core contexts.
ASP.NET Core Web API: Plugin Controllers and Services
A concise guide on how to implement plugin controllers and share services between the ASP.NET Web API application and the plugin. I find that maintaining an enterprise level web API tends to result in a large monolithic application, particularly in older technologies such as Microsoft's MVC framework. Microservices provide a nice solution to compartmentalize stand-alone services but I notice that this results in numerous discrete repos, adds complexity to automated deployment, involves IIS configurations, and if global policies are changed (security, logging, database connections, etc), every microservice needs to be touched.
ASP.NET Core 6: Minimal APIs, two reasons why I can’t do without it so far
A few days ago I introduced you to the minimal APIs, in this blog post: https://anthonygiretti.com/2021/08/12/asp-net-core-6-working-with-minimal-apis/ They are an evolution of the Route to Code concept which was already an interesting concept in ASP.NET Core. I described how it works here: https://anthonygiretti.com/2020/06/29/nano-services-with-asp-net-core-or-how-to-build-a-light-api/ Today I will explain to you the two reasons why I can not do without it
ASP.NET C# - Create PDF Invoice using iText7 Library
Today we will create a pdf invoice document (a sample invoice pdf file) in ASP.NET. For this you will require iText7 library to be installed in your project. PDF will contain seller information, customer info and product details along with prices and its quantity.
Self-hosted integration tests in ASP.NET
In 2020 I developed a sizeable code base for an online restaurant REST API. In the spirit of outside-in TDD, I found it best to test the HTTP behaviour of the API by actually interacting with it via HTTP. Sometimes ASP.NET offers more than one way to achieve the same end result. For example, to return 200 OK, you can use both OkObjectResult and ObjectResult. I don't want my tests to be coupled to such implementation details, so by testing an API via HTTP instead of using the ASP.NET object model, I decouple the two. You can easily self-host an ASP.NET web API and test it using an HttpClient. In this article, I'll show you how I went about it.
ASP.NET Web API 2系列(四):基于JWT的token身份认证方案
通过前边的系列教程,我们可以掌握WebAPI的初步运用,但是此时的API接口任何人都可以访问,这显然不是我们想要的,这时就需要控制对它的访问,也就是WebAPI的权限验证。验证方式非常多,本文就重点介绍一种常用的验证方式:基于JWT的token身份认证方案。
Lee's Blog: Conquer ASP.Net Boilerplate Query Performance in LINQPad, (Announcing LINQPad.ABP)
Ever made it to production only to realize your code fails miserably at scale? When performance problems rear their gnarly head and there name is EntityFramework, there is but one blade to slice that gordeon knot: LINQPad.
Refreshing your Legacy ASP.NET IdentityServer Client Applications (with PKCE)
If you have an ASP.NET MVC application in production that uses IdentityServer, you may soon find yourself in its codebase due to the upcoming SameSite cookie changesspearheaded by Google.While you’re in there messing with the code, why don’t you give your old application a freshen up and update your...
Debugging ASP.NET Web Request Errors: The Complete Guide
In this article, we’re going to see how to get the most information about the failed request. This includes the error code, the type of failure, the method where the exception occurred, the exception type, exception stack trace, local variables, and the exact line of code where the exception happened. Not all failed requests are caused by an exception in code, but 500 errors do. We’ll focus mostly on failures caused by exceptions.
Build a .NET App Quickly with Docker
In this post, you’ll build a .Net Framework application with Visual Studio on Windows 10. You’ll then containerize your application so it can be reliably deployed and run on any instance of Docker for Windows.Since containers share the host operating system, you can only run containers compatible wi...
Advanced error handling techniques
This post describes some (more) advanced error handling techniques. I’ll probably do a series because this topic is large and there’s quite a few things that need to be cleared out, but we’ll see....
HttpRepl: A command-line tool for interacting with RESTful HTTP services
The ASP.NET team has built a command-line tool called HttpRepl. It lets you browse and invoke HTTP services in a similar way to working with files and folders. You give it a starting point (a base URL) and then you can execute commands like “dir” and “cd” to navigate your way around the API...
Dealing with Application Base URLs and Razor link generation while hosting ASP.NET web apps behind Reverse Proxies
I'm quietly moving my Websitefrom a physical machine to a number of Cloud Services hosted in Azure. This is an attempt to not just modernize the system - no reason to change things just to change them - but to take advantage of a number of benefits that a straight web host sometimes doesn't have. I ...
Creating Custom Constraints For Razor Pages Routes
Razor Page already includes a wide range of constraints that can be used to help disambiguate routes. It is also possible for you to create your own custom constraint and then register that with the routing system.
Using NodaTime with Dapper
This is a part of a series of blog posts on data access with Dapper. To see the full list of posts, visit the Dapper Series Index Page. After my recent misadventures attempting to use Noda Time with Entity Framework Core, I decided to see what it would take to use Dapper in a the same scenario.
Build a REST API with ASP.NET Web API
Do you need to build a REST API with ASP.NET Web API? If you’re creating a new API, you should probably create it with .NET Core. But it’s not always possible to use the latest and greatest technologies. If you’re working in an existing ASP.NET 4.x app, or the organization you work for hasn’t approved the use of .NET Core yet, you may need to build an API in .NET Framework 4.x. That is what you will learn here. You’ll also learn how to access your API from another application (for machine-to-machine communication) and prevent unauthorized access to your API. As you go, I’ll show you how to implement standard design patterns so it will be easy for other developers to understand and work with your API.
Running ASP.NET Web API Solution in Docker
This article describes how to containerize an ASP.NET WebApi solution with Visual Studio, how to pass data via environment variables and also how to run the images in docker without Visual Studio. The tricky part when running a web solution with a web API in docker containers is to map the URLs and ports so that the code running inside the docker container can be accessed from outside. This is a question of docker configuration and minor code changes.
A Practical Example Of Asynchronous Programming in C# and ASP.NET
I'll make no secret of it: I LOVE asynchronous programming in ASP.NET! I love it so much that I submitted a talk for CodeMash 2019 called "Hold Up, Wait a Minute, Let Me Put Some Async In It," which I actually got to present despite that ridiculous title. This post is a direct result of that talk, in which I took an existing synchronous ASP.NET web application and slowly refactored it to use asynchronous programming. I figure that more than just CodeMash's attendees might find this useful.
【ABP框架系列学习】N层架构(3)
目录0.引言1.DDD分层2.ABP应用构架模型客户端应用程序(Client Applications)表现层(Presentation Layer)分布式服务层(Distributed Service Layer)应用层(Application Layer)领域层基础设施层3.使用ABP项目模版快速生成应用程序0.引言应用程序的分层是一种广泛接受的技术...
【ABP框架系列学习】介绍篇(1)
0.引言该系列博文主要在【官方文档】及【tkbSimplest】ABP框架理论研究系列博文的基础上进行总结的,或许大家会质问,别人都已经翻译过了,这不是多此一举吗?原因如下:1.【tkbSimplest】的相关博文由于撰写得比较早的,在参照官方文档学习的过程中,发现部分知识未能及时同步(当前V4.0.2版本),如【EntityHistory】、【Multi-Lingual Engitie...