<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel xmlns:media="http://search.yahoo.com/mrss/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <title>ABP.IO Stories</title>
    <link>https://abp.io/community/articles</link>
    <description>A hub for ABP Framework, .NET, and software development. Access articles, tutorials, news, and contribute to the ABP community.</description>
    <lastBuildDate>Thu, 12 Mar 2026 12:29:20 Z</lastBuildDate>
    <generator>Community - ABP.IO</generator>
    <image>
      <url>https://abp.io/assets/favicon.ico/favicon-32x32.png</url>
      <title>ABP.IO Stories</title>
      <link>https://abp.io/community/articles</link>
    </image>
    <a10:link rel="self" type="application/rss+xml" title="self" href="https://abp.io/community/rss?member=malik.masis" />
    <item>
      <guid isPermaLink="true">https://abp.io/community/posts/asp.net-core-7.0-output-caching-middleware-4ffg29la</guid>
      <link>https://abp.io/community/posts/asp.net-core-7.0-output-caching-middleware-4ffg29la</link>
      <a10:author>
        <a10:name>malik.masis</a10:name>
        <a10:uri>https://abp.io/community/members/malik.masis</a10:uri>
      </a10:author>
      <category>dotnet7</category>
      <category>dotnet</category>
      <title>ASP.NET Core 7.0 Output Caching Middleware</title>
      <description>A new middleware component included with.NET 7 is output caching instead of calling for each request.</description>
      <pubDate>Fri, 25 Nov 2022 08:41:00 Z</pubDate>
      <a10:updated>2026-03-12T10:26:05Z</a10:updated>
      <content:encoded><![CDATA[<h1>Output Caching Middleware</h1>
<p>This is an example project that demonstrates using output caching middleware. See the article that explain this project:</p>
<p><strong>https://abp.io/community/posts/output-caching-middleware-4ffg29la</strong></p>
]]></content:encoded>
      <media:thumbnail url="https://abp.io/images/others/blank-cover-image-150_79.png" />
      <media:content url="https://abp.io/images/others/blank-cover-image-150_79.png" medium="image" />
    </item>
    <item>
      <guid isPermaLink="true">https://abp.io/community/posts/consuming-http-apis-from-a-.net-client-using-abps-client-proxy-system-xriqarrm</guid>
      <link>https://abp.io/community/posts/consuming-http-apis-from-a-.net-client-using-abps-client-proxy-system-xriqarrm</link>
      <a10:author>
        <a10:name>malik.masis</a10:name>
        <a10:uri>https://abp.io/community/members/malik.masis</a10:uri>
      </a10:author>
      <category>proxy-system</category>
      <category>client-proxy</category>
      <title>Consuming HTTP APIs from a .NET Client Using ABP's Client Proxy System</title>
      <description>We  explained how to consume HTTP APIs from a .NET application using ABP's dynamic and static client-side proxy systems. I will start by creating a new project and consume the HTTP APIs from a .NET console application using dynamic client proxies. Then I will switch to static client proxies. Finally, I will glance at the differences and similarities between static and dynamic generic proxies.</description>
      <pubDate>Tue, 13 Sep 2022 10:45:00 Z</pubDate>
      <a10:updated>2026-03-12T12:29:13Z</a10:updated>
      <content:encoded><![CDATA[<h1>Consuming HTTP APIs from a .NET Client Using ABP's Client Proxy System</h1>
<p>In this article, I will explain how to consume HTTP APIs from a .NET application using ABP's <a href="https://docs.abp.io/en/abp/latest/API/Dynamic-CSharp-API-Clients">dynamic</a> and <a href="https://docs.abp.io/en/abp/latest/API/Static-CSharp-API-Clients">static</a> client-side proxy systems. I will start by creating a new project and consume the HTTP APIs from a .NET console application using dynamic client proxies. Then I will switch to static client proxies. Finally, I will glance at the differences and similarities between static and dynamic generic proxies.</p>
<p>Here the main benefits of using the client-side proxy system (either dynamic or static):</p>
<ul>
<li>Automatically maps C# method calls to remote server HTTP calls by considering the HTTP method, route, query string parameters, request payload and other details.</li>
<li>Authenticates the HTTP Client by adding an access token to the HTTP header.</li>
<li>Serializes to and deserialize from JSON.</li>
<li>Handles HTTP API versioning.</li>
<li>Adds correlation id, current tenant id and the current culture to the request.</li>
<li>Properly handles the error messages sent by the server and throws proper exceptions.</li>
</ul>
<h2>Create a new ABP application with the ABP CLI</h2>
<p>Firstly create a new solution via <a href="https://docs.abp.io/en/abp/latest/CLI">ABP CLI</a>:</p>
<pre><code class="language-shell">abp new Acme.BookStore
</code></pre>
<blockquote>
<p>See ABP's <a href="https://docs.abp.io/en/abp/latest/Getting-Started-Setup-Environment?UI=MVC&amp;DB=EF&amp;Tiered=No">Getting Started document</a> to learn how to create and run your application, if you haven't done it before.</p>
</blockquote>
<h2>Create the application service interface</h2>
<p>I will start by creating an application service and exposing it as an HTTP API to be consumed by remote clients. First, define an interface for the application service; Create an <code>IBookAppService</code> interface in the <code>Books</code> folder (namespace) of the <code>Acme.BookStore.Application.Contracts</code> project:</p>
<pre><code class="language-csharp">using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;

namespace Acme.BookStore.Books
{
    public interface IBookAppService : IApplicationService
    {
        Task&lt;PagedResultDto&lt;BookDto&gt;&gt; GetListAsync();
    }
}
</code></pre>
<p>Also add a <code>BookDto</code> class inside the same <code>Books</code> folder:</p>
<pre><code class="language-csharp">using System;
using Volo.Abp.Application.Dtos;

namespace Acme.BookStore.Books
{
    public class BookDto
    {
        public string Name { get; set; }
        public string AuthorName { get; set; }
        public float Price { get; set; }
    }
}
</code></pre>
<h2>Implement the application service</h2>
<p>It is time to implement the <code>IBookAppService</code> interface. Create a new class named <code>BookAppService</code> in the <code>Books</code> namespace (folder) of the <code>Acme.BookStore.Application</code> project:</p>
<pre><code class="language-csharp">using Acme.BookStore.Permissions;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;

namespace Acme.BookStore.Books
{
    public class BookAppService : ApplicationService, IBookAppService
    {
        public Task&lt;PagedResultDto&lt;BookDto&gt;&gt; GetListAsync()
        {
            var bookDtos = new List&lt;BookDto&gt;()
            {
                new BookDto(){ Name = &quot;Hunger&quot;, AuthorName =&quot;Knut Hamsun&quot;, Price = 50},
                new BookDto(){ Name = &quot;Crime and Punishment&quot;, AuthorName =&quot;Dostoevsky&quot;, Price = 60},
                new BookDto(){ Name = &quot;For Whom the Bell Tolls&quot;, AuthorName =&quot;Ernest Hemingway&quot;, Price = 70}
            };
            return Task.FromResult(new PagedResultDto&lt;BookDto&gt;(
               bookDtos.Count,
               bookDtos
           ));
        }
    }
}
</code></pre>
<p>It simply returns a list of books. You probably want to get the books from a database, but it doesn't matter for this article. If you want it, you can fully implement <a href="https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&amp;DB=EF">this tutorial</a>.</p>
<h2>Consume the app service from the console application</h2>
<p>The startup solution comes with an example .NET console application (<code>Acme.BookStore.HttpApi.Client.ConsoleTestApp</code>) that is fully configured to consume your HTTP APIs remotely. Change <code>ClientDemoService</code> as shown in the following <code>Acme.BookStore.HttpApi.Client.ConsoleTestApp</code> project (it is under the <code>test</code> folder).</p>
<pre><code class="language-csharp">using Acme.BookStore.Books;
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.DependencyInjection;

namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp;

public class ClientDemoService : ITransientDependency
{
    private readonly IBookAppService _bookAppService;

    public ClientDemoService(IBookAppService bookAppService )
    {
        _bookAppService = bookAppService;
    }

    public async Task RunAsync()
    {
        var listOfBooks = await _bookAppService.GetListAsync(new PagedAndSortedResultRequestDto());
        Console.WriteLine($&quot;Books: {string.Join(&quot;, &quot;, listOfBooks.Items.Select(p =&gt; p.Name).ToList())}&quot;);
    }
}
</code></pre>
<p>We are basically injecting the <code>IBookAppService</code> interface to consume the remote service. ABP handles all the details (performing HTTP request, deserializing the resulting JSON object, etc) for us.</p>
<p>You can run the application to see the output:</p>
<pre><code>Books: Hunger, Crime and Punishment, For Whom the Bell Tolls
</code></pre>
<h2>Convert the application to use static client proxies</h2>
<p>The <a href="https://docs.abp.io/en/abp/latest/Startup-Templates/Application">application startup template</a> comes pre-configured for the <strong>dynamic</strong> client proxy generation, in the <code>HttpApi.Client</code> project. If you want to switch to the <strong>static</strong> client proxies, you should change <code>context.Services.AddHttpClientProxies</code> to <code>context.Services.AddStaticHttpClientProxies</code> in the module class of your <code>HttpApi.Client</code> project:</p>
<pre><code class="language-csharp">public class BookStoreHttpApiClientModule : AbpModule
{
    public const string RemoteServiceName = &quot;Default&quot;;

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
       // Other configurations...

        context.Services.AddStaticHttpClientProxies(
            typeof(BookStoreApplicationContractsModule).Assembly,
            RemoteServiceName
        );
    }
}
</code></pre>
<p>The <code>AddStaticHttpClientProxies</code> method gets an assembly, finds all service interfaces in the given assembly, and prepares for static client proxy generation.</p>
<p>Now you're ready to generate the client proxy code by running the following command in the root folder of your client project <strong>while your server-side project is running</strong>:</p>
<pre><code class="language-bash">abp generate-proxy -t csharp -u http://localhost:44397/
</code></pre>
<blockquote>
<p>The URL (<code>-u</code> parameter's value) might be different for your application. It should be the server's root URL.</p>
</blockquote>
<p>You should see the generated files under the selected folder:</p>
<p><img src="https://raw.githubusercontent.com/abpframework/abp/dev/docs/en/Community-Articles/2022-05-16-Consuming-Rest-Api-By-Using-Static-Proxy/static-proxy.png" alt="files of the static proxy" /></p>
<p>Now you can run the console client application again. You should see the same output:</p>
<pre><code>Books: Hunger, Crime and Punishment, For Whom the Bell Tolls
</code></pre>
<h2>Add authorization</h2>
<p>The ABP Framework provides an <a href="https://docs.abp.io/en/abp/latest/Authorization">authorization system</a> based on <a href="https://docs.microsoft.com/en-us/aspnet/core/security/authorization/introduction">ASP.NET Core's authorization infrastructure</a>. We can define permissions and restrict access to some of our application's functionalities, so only the allowed users/clients can use these functionalities. Here, I will define a permission to be able to get the list of books.</p>
<h3>Defining a permission</h3>
<p>Under <code>Acme.BookStore.Application.Contracts</code> open <code>BookStorePermissions</code> and paste the below code:</p>
<pre><code class="language-csharp">namespace Acme.BookStore.Permissions;

public static class BookStorePermissions
{
    public const string GroupName = &quot;BookStore&quot;;

    public static class Books
    {
        public const string Default = GroupName + &quot;.Books&quot;;
    }

}
</code></pre>
<p>You also need to change <code>BookStorePermissionDefinitionProvider</code> under the same folder and project as follows:</p>
<pre><code class="language-csharp">using Acme.BookStore.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

public class BookStorePermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        var bookStoreGroup = context.AddGroup(BookStorePermissions.GroupName);
        bookStoreGroup.AddPermission(BookStorePermissions.Books.Default);
    }
}
</code></pre>
<h3>Authorizing the application service</h3>
<p>We can now add the <code>[Authorize(BookStorePermissions.Books.Default)]</code> attribute to the <code>BookAppService</code> class:</p>
<pre><code class="language-csharp">[Authorize(BookStorePermissions.Books.Default)]
public class BookAppService : ApplicationService, IBookAppService
{
    ...
}
</code></pre>
<p>If you run the server now, then run the console client application, you will see the following error on the console application:</p>
<pre><code>Unhandled exception. Volo.Abp.Http.Client.AbpRemoteCallException: Forbidden at
Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1
.ThrowExceptionForResponseAsync(HttpResponseMessage response)...
</code></pre>
<p>To fix the problem, we should grant permission to the admin user. We are granting permission to the admin user because the console application is configured to use the Resource Owner Password Grant Flow. That means the client application is consuming services on behalf of the admin user. You can see the configuration in the <code>appsettings.json</code> file of the console application.</p>
<h3>Granting the permission</h3>
<p>Once you define the permissions, you can see them on the permission management modal.</p>
<p>Go to the Administration -&gt; Identity -&gt; Roles page, select the Permissions action for the admin role to open the permission management modal:
<img src="https://raw.githubusercontent.com/abpframework/abp/dev/docs/en/Community-Articles/2022-05-16-Consuming-Rest-Api-By-Using-Static-Proxy/permission.png" alt="persmisson" />
Grant the permissions you want and save the modal.</p>
<h2>Dynamic vs static proxies</h2>
<p>Static generic proxies provide <strong>better performance</strong> because they don't need to run on runtime, but you should <strong>re-generate</strong> them once you change the API endpoint definition. Dynamic generic proxies don't need to be re-generated because they work on the runtime but they have a slight performance penalty.</p>
<h2>Further Reading</h2>
<p>In this tutorial, I explained how you can create an example project and apply a static client proxy instead of a dynamic client proxy. I also summarized the differences between both approaches. If you want to get more information, you can read the following documents:</p>
<ul>
<li><a href="https://docs.abp.io/en/abp/latest/API/Static-CSharp-API-Clients">Static C# API Client Proxies</a></li>
<li><a href="https://docs.abp.io/en/abp/latest/API/Dynamic-CSharp-API-Clients">Dynamic C# API Client Proxies</a></li>
<li><a href="https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&amp;DB=EF">Web Application Development Tutorial</a></li>
</ul>
]]></content:encoded>
      <media:thumbnail url="https://abp.io/images/others/blank-cover-image-150_79.png" />
      <media:content url="https://abp.io/images/others/blank-cover-image-150_79.png" medium="image" />
    </item>
    <item>
      <guid isPermaLink="true">https://abp.io/community/posts/using-masstransit-via-eshoponabp-8amok6h8</guid>
      <link>https://abp.io/community/posts/using-masstransit-via-eshoponabp-8amok6h8</link>
      <a10:author>
        <a10:name>malik.masis</a10:name>
        <a10:uri>https://abp.io/community/members/malik.masis</a10:uri>
      </a10:author>
      <category>masstransit</category>
      <category>eShopOnAbp</category>
      <category>microservices</category>
      <title>Using MassTransit via eShopOnAbp</title>
      <description>MassTransit is a lightweight service bus for building distributed .NET applications. MassTransit makes it easy to create applications and services. We demonstrated how to publish and consume the events with the eShopOnAbp project by using MassTransit</description>
      <pubDate>Tue, 13 Sep 2022 10:43:50 Z</pubDate>
      <a10:updated>2026-03-12T06:50:06Z</a10:updated>
      <content:encoded><![CDATA[<h1>Using MassTransit via eShopOnAbp</h1>
<p><strong>https://abp.io/community/articles/using-masstransit-via-eshoponabp-8amok6h8</strong></p>
]]></content:encoded>
      <media:thumbnail url="https://abp.io/images/others/blank-cover-image-150_79.png" />
      <media:content url="https://abp.io/images/others/blank-cover-image-150_79.png" medium="image" />
    </item>
  </channel>
</rss>