Hello, welcome toPeanut Shell Foreign Trade Network B2B Free Information Publishing Platform!
18951535724
  • Fire! C#+asp. Net core fields: abandoning the flair of the flower, but less than 90%. The pit

       2026-03-09 NetworkingName990
    Key Point:I. The more the technology "bring" holds up productionIt's a pain in the ass when you're doing it: you've got a new framework on the market, new tools coming up. You're learning this today, you're learning it tomorrow, and you're not going to know it until you're in the wind。But there is a senior developer, and the latest project is going the other wayno new, no flowers, only old goods like c#, asp. Net core, ef core, with back-office work

    Optimizing speed of access on the pasp site

    I. The more the technology "bring" holds up production

    It's a pain in the ass when you're doing it: you've got a new framework on the market, new tools coming up. You're learning this today, you're learning it tomorrow, and you're not going to know it until you're in the wind。

    But there is a senior developer, and the latest project is going the other way — no new, no flowers, only old “goods” like c#, asp. Net core, ef core, with back-office workers and clouds, but with zero major failures on the line and a full load of vomit。

    What is even more surprising is that his core logic is not "dazzling," but "bringing is stability": deliberately avoiding all the novelty frameworks and standardizing only those tools that can be quickly debugged, predicable。

    That's curious: can you really do something more rational by abandoning the technology? Are those black technologies that we're after, or are they a burden? Let's start with the core technology of this fieldhouse, and you'll have the answer。

    Detailed key technologies (open source free, directly available)

    The core components of the warehouse, which are free of charge, community mature “hard currency” and can be used directly for commercial projects at no cost, are as follows:

    1. C#: the object-oriented programming language developed by microsoft, cross-platform, high performance, and the github-related eco-observatories aggregate over 1 million, are the core foundation for . Net development and are completely free of charge。

    2. Asp. Net core: the cross-platform web development framework, lightweight, efficient, supporting front-end separation, micro-services, github 87,000+, free open source, is the most mainstream web framework in the ... Net ecology。

    Ef core: entity fRamework core, lightweight orm framework, simplified database operation, support for multiple databases (postgresql, mysql, etc.), github 29,000+, free open source, seamless interface with assp. Net core。

    Opentelemetry: open source observation framework, support for tracking, indicator collection, enabling mapping of production, github marker 23,000+, free open source, adapted to all types of cloud-based environment。

    Background workers: . Net built-in back-office task-processing components that do not require additional third-party tools, which are used free of charge and are specialized in the handling of different tasks (mailing, queuing, etc.)。

    Core decomposition: 9 operational points that can be replicated (complete code attached)

    The core idea of the developer was to “construct reliable structures with stable components” and each step was designed around “default avoidance, easy to debug”, which was broken down from point to point, and all codes could be reproduced directly and new hands could easily be taken。

    1. Building infrastructure service templates (core, directly replicated)

    The basic template was the cornerstone of the project, designed to be “unsurprising” and designed to make it all clear at the time of launch and avoid subsequent pedestals。

    Var builder = webapplication. Createbuilder (args);
    / basic configuration: controller, health check, interface document
    i'm not sure i'm going to do itNrollers();
    bilder. Services. Addhealthchecks();
    (b) builder. Services. Addendpointsapiexplorer();
    // configure ef core, connect postgresql data library
    i'm sorry, i'm sorry(options=>)
    other organiser
    options. Usenpgsql"primaydb");
    i'm not sure.
    / reliance on injection: business services, back-office workers
    i'm sorry, i'm sorry, i'm sorry, but i'm sorry(a) (a) (ii);
    i'm sorry, i'm sorry, but i'm sorry(a) (a) (ii);
    // configure opentelemetry to achieve observability (track interface, http request, database)
    i'm sorry, i'm sorry, i'm sorry. With tracing
    other organiser
    t. Addaspnetcoreinstration();
    t. Addhtpclintinstration();
    t. Addnpgsql();
    i'm not sure. Var app = builder. Build();
    // map health check interface, controller
    app. Maphealth checks (“/health”);
    mapcoNrollers();
    app. Run();

    There are two key designs, which appear to be simple codes: first, relying on the injection of the full visible configuration, and subsequent calibrations allow rapid positioning problems; and second, ef core and observability at start-up, without waiting until on-line, to avoid omissions。

    Asp. Net core interface designed for “resistance”

    He found that most of the api malfunctions were not logical errors, but rather “failure management” — time lapses, misconfiguration of the test, which could turn the failure into a chain breakdown. He therefore designed the interface “soft and steady” and gave the reliability logic to the http client。

    Step 1: configure http client (with retest, melting policy)

    I'm sorry, i'm sorry(clint =)
    other organiser
    it's a good idea, client(a) asesaddress = new uri ("https://pricing. International");
    ♪ i'm not sure ♪
    / / retry strategy: three retests after failure at 100 ms, 200 ms, 300 ms
    addtrancenthtperrorpolicy(p = >)
    waterandretryasync (3, retry= >timespan. Frommilliseco))
    / / melting policy: 30 seconds after 5 failures to avoid frequent requests to slow down downstream services
    addtrancenthtperrorpolicy(p = >)
    p. Circuitbreakerasync (5, timespan. Fromseco)(a) the right to self-determination;

    Step 2: develop a simple controller (receiving requests, calling services only)

    [apicontroller]
    [route("api/orders")]
    it's a public class orderscoNtroller: coNtrollerbI'm sorry. Other organiser
    i'm sorryPricing;
    i'm sorryI'm sorry.
    / tectonic injection, without unnecessary logic
    it's a public orderscoI mean, i don't know. Other organiser
    pricing=pricing;
    orders = codes;
    ♪ i'm sorry ♪
    [http post]
    it's not like you're in troubleCreateorderrequest request
    other organiser
    / / call price services, create orders, all logic of service level
    var price = await  pricing. Getpriceasync (request. Sku);
    var order = await  orders. Createasync (request, price);
    return ok (order);
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪

    Core strengths: re-testing and melting strategies are fully visible, and subsequent interfaces are delayed and can be viewed directly through indicators, with no blind screening。

    Ef core operations: regulating the boundaries of business, avoiding memory leaks

    Ef core works well, but many people treat it as a “magic dyslexia” that ignores the optimization of affairs and queries, leading to a surge in memory and a collapse of performance in the production environment. His approach is to write for visible control services and read operations to close track。

    Writing operations (creation of orders, visible matters):

    I mean, i don't know. Other organiser
    i'm sorryNo, no, no, noNtext  db;
    public order (appdbco)I don't know. Other organiser
    db = db;
    ♪ i'm sorry ♪
    it's not like you're in troubleCreateasync. Other organiser
    // visible opening of affairs, control of the range of matters
    we're talking var txI don't know, pleaseNasync();
    ♪ order ♪
    other organiser
    id = guid. Newguid()
    sku = request. Price = price. Createdat = datetimeofset. Utcnow
    };
    db. Orders. Add. Await  db. Savechangesasync();
    await tx. Commitasync();
    i'm sorry.
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪

    Read operation (query order, close track):

    It's not like you're in troubleGetasync (guid id)
    other organiser
    db. Orders
    as notracking() / / close change tracking to reduce memory occupancy
    where? Select(o = > new order
    other organiser
    id = o. Id,
    sku = o. Sku,
    price. Createdat = o. Createdat
    ♪ i'm not sure ♪
    ... Singleordefaultasync();
    ♪ i'm sorry ♪

    Key role: disconnecting change tracking avoids the ef core quietly taking over large amounts of memory, particularly in high-coming settings, effectively preventing performance。

    4. Back-office workers + outbox mode: no step-by-step tasks to fail mouth

    He states that all walk-through operations (mailing, dispatching, pushing) are handled by back-office workers, and the controller is responsible only for writing the database, without other side-effects, and avoiding the delay of the interface。

    Step 1: create outbox information sheet (store to be processed for walk)

    It's a public class outlookmessenger. Other organiser
    public long id { get; set;}
    public string type { get; set;} = default! / / message type
    public string payload { get; set;} = default! / / message content
    public datetimeofsetcreatedat { get; set;} // created
    public datetimeoffset?
    ♪ i'm sorry ♪

    Step two: achieve backstage workers (volume processing of outbox messages)

    Public class outlookprocessor: background service
    other organiser
    i'm sorryScopefactory;
    i'm sorryBus;
    public outlook processor
    other organiser
    scopefactory =scopefactory;
    bus = bus;
    ♪ i'm sorry ♪
    i don't knowNo, no, no, no. Other organiser
    // recycle execution until service ceases
    while you're here, while you're here,
    other organiser
    scopefactory. Createscope();
    var db = scope. Serviceprovider. Getrequiredservice(a) (a) (ii);
    / bulk access to unprocessed information (50 at a time to avoid excessive pressure)
    ♪ watch ♪
    where?
    ... Orderby(x => x. Id)
    take (50)
    . Tolistasync;
    / / handle messages individually
    foreach (var msg in watch)
    other organiser
    await  bus. Publishasync (msg. Type, msg. Payload, stopping token);
    msg. Processedat = datetimeofset. Utcnow;//mark as processed
    ♪ i'm sorry ♪
    await db. Save changesasync (stopping token);
    wait task. Delay (500, stopping token); / / interval 500 ms to avoid frequent data queries library
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪

    Core value: the interface does not have to wait for a step-by-step mission to be completed, even if the message bus fails, the task will exist in the database and will not be lost, and will be automatically processed after subsequent recovery, avoiding delay and data loss of the interface。

    5. Other critical configurations (necessary pit avoidance)

    In addition to the above-mentioned core elements, there are four configurations that will further enhance the stability of the project, all of which are drawn from operational experience:

    (1) configuration validation: validation of configuration at start-up, avoid deployment before missing configuration

    / / tie database configuration and verify the connection string
    i'm sorry, i'm sorry( )
    . BindI don't know. Validate (o = >! String. Isnull orwhitespace)
    validateoNstart();
    // strong type configuration category
    the public class dboptions
    other organiser
    i'm not sure i'm going to do this{get; set;} = default!
    ♪ i'm sorry ♪

    (2) improved detectability: additional indicator collection to facilitate troubleshooting

    I'm sorry, i'm sorry, i'm sorry. With tracing
    other organiser
    addaspnetcoreinstration();
    (b) addhttpclintinstration();
    tracer. Addnpgsql();
    ♪ i'm not sure ♪
    with metrics. Other organiser
    / interface indicators
    / run-time indicators
    i'm not sure.
    // log records changes in database connectivity
    db. DatabI don't know what you're talking aboutNneaction(). Statechange + = (s, e) >
    other organiser
    logger. Logdebug ("db state changed: ol > } } " ""), e. Organal state, e. Current state);
    };

    (3) cloudtopasian health check: fit k8s, avoid failure cases receiving traffic

    / configure database health checks
    i'm sorry, i'm sorry.
    ... Addnpgsql"primaydb", name: "db");

    K8s probe configuration (yaml):

    I'm sorry. Httpget:
    path: /health
    this post is part of our special coverage syria protests 2011. Respect probe:
    httpget:
    path: /health
    this post is part of our special coverage syria protests 2011

    (4) consistency control: avoiding storm requests and protecting downstream services

    // limit the number of rounds to 50, avoid overwhelm downstream services
    i'm sorryI'm sorry, i'm sorry. It's not like you're in troubleGetpriceasync (string sku)
    other organiser
    (b) waitasync ();
    try
    other organiser
    http://tfromjsonasync(#34;/price/{sku}”);
    ♪ i'm sorry ♪
    really. Other organiser
    pricinggate. Release(); / /release the signal volume
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪

    The truth, the advantages and the costs of a “bringing cage”

    This set of “no new, no more stable” net bars does address the core pains of the production environment — fewer failures, easier to calibrate, more stable — but it is not perfect, and it can be argued that it is really useful。

    Advantages: abandoning novelty for three core values

    Reducing the cost of debugging: all components are mature and stable and, in case of problems, developers are deduced by their own business logic rather than by the framework's “new and strange characteristics” and need not waste time in order to sort out the framework。

    Improved deployment stability: standardized mix of components that allow the project to behave predictably in the context of high confluence and reliance on malfunctions, without inexplicable problems such as “unnamed collapse” of “inventory surge”。

    3. Reducing the costs of team learning: teams need not spend considerable time learning on the new framework, focusing on business logic and architecture, especially for small and medium-sized teams, allowing rapid landing of projects and reducing trial error costs。

    Cost: two compromises are accepted if you choose stability

    The lack of “dazzling” space: this warehouse has no new glucose, no small high-level features, and may be “dry” for developers who seek technological freshness and develop “new skills”。

    2. Lack of flexibility in part: for small, lightweight, non-core projects, the standardized configuration may appear to be “overweighted” and less rapid and simple to deploy than some very simple frameworks。

    Thinking: is technology development important, whether it's “new” or “stability”? There is no absolute answer — core business, production-level projects, stability is far more important than novelty, and after all, a failure can lead to irreparable losses; while individual hands-on, non-core small projects, properly experimenting with new technologies, can build on experience。

    It is undeniable, however, that many developers are mistaken for “newness” as being “strong”, blindly using the new framework instead of improving efficiency, but not familiar with it, leading to frequent project failures。

    Iv. Relevance: who does this fit? What can it solve

    The . Net battlehouse is not a “one-size-fits-all template”, but it can be precise in addressing the three core issues, fit for a specific group of people and determine whether it works。

    1. Accurately addressed 3 major pain points (as required by users)

    (i) production failure: each time the connection is on the line, the interface is overtime, the memory leaks, the reliance on frequent malfunctions, and it cannot be traced

    (2) inefficient team: frequent learning of the new framework, inconsistent code styles, high commissioning, maintenance costs and slow project advancement

    (3) the structure is not standardized: interfaces, databases, scrambling tasks, clear boundaries, follow-up difficulties and expansion difficulties。

    2. 2 big itcht points met (as desired by users)

    (i) a set of templates that can be used directly: the copy code can be used without a single set of structures and saves time for development

    (2) stable and reliable production security: no need to worry about the bug of the framework itself, focusing on business and increasing the success rate of the project。

    3. One big kicker (upper user)

    After deployment, almost zero major malfunctions can also be stabilized in high conjunction scenarios, and when calibrated, rapid positioning can be achieved through observational tools, with no need to stay up overnight, significantly reducing development and mobility pressures。

    4. Suitable 3 categories

    (1) small- and medium-sized team developers: small team size, insufficient effort to study the new framework and need a stable, easily maintained warehouse for quick landing projects

    (ii) developers responsible for core business: core business should not be at fault and priority should be given to stabilization rather than novelty

    (3). Net new developers: without being confused by a new complex of frameworks, mastering the standardized warehouse, laying the foundation, then gradually learning new features and avoiding a curve。

    Interactive topic: are you a “new party” or a “stability party”

    Seeing here, trusting you have your own judgment on this “buring but stable” net inn。

    In fact, technology itself is not good or bad. The key is a fit scenario — some feel that “stable is core competitiveness” and others feel that “stable is core competitiveness”。

     
    ReportFavorite 0Tip 0Comment 0
    >Related Comments
    No comments yet, be the first to comment
    >SimilarEncyclopedia
    Featured Images
    RecommendedEncyclopedia