Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
F

Fred2834

@Fred2834
About
Posts
12
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Api call connection resets
    F Fred2834

    Ok, so problem solved, my colleague found the parameter that controls this, here's the info, hopefully it will help someone! In the web.config, you can set the parameter requestTimeout to the value you want, as in :

    Alternatively you can also set this parameter via the Configuration Editor in IIS.

    ASP.NET dotnet csharp asp-net windows-admin ai-coding

  • Api call connection resets
    F Fred2834

    Hello, In an ASP .Net Core 8 API, we have an issue with the processing of a call that lasts longer than 2 minutes. It lasts long because we have to parse a ton of files (call can be 5-6 minutes), we know this should be improved, but that's beside the point here. In a previous version of this API (.Net Framework 4.8), this call used to last just as long, and the API did not reset the connection. In the .Net 8 version, we get such a message : Connection id "xxx" reset. Connection id "xxx" sending FIN because: "The Socket transport's send loop completed gracefully." Connection id "xxx" disconnecting. After some googling and copilot'ing, we found that this seems related to Kestrel configuration, so we tried several things: - serverOptions.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(5); - Changed a few parameters related to timeouts in IIS - Changed the timeout parameter from the client app calling the API .. but nothing works. Does anyone have experience with this ? It's clear that the timeout duration has to be adjusted somewhere, but we have no idea where to look. Thanks in advance :)

    ASP.NET dotnet csharp asp-net windows-admin ai-coding

  • Question about Dependency Injection
    F Fred2834

    Hello guys, I have an issue related to dependency injection in the Program.cs of a .Net 7 application. In this case it's an API, but that does not really matter. Before calling the line: var app = builder.Build(); I am adding a few singletons normally with :

    builder.Services.AddSingleton();
    builder.Services.AddSingleton();

    My issue is that the HTTP client singleton requires info from the config singleton, and it's not a simple case of injecting the former into the latter. We can't use appsettings.json to manage our configuration, that would be too easy, and because the second one is an HTTP client, I have this code :

    builder.Services.AddSingleton();
    builder.Services.AddHttpClient(client =>
    {
    client.BaseAddress = new Uri(myConfig.myURI);
    client.DefaultRequestHeaders.Accept.Clear();
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

    }).ConfigurePrimaryHttpMessageHandler(() =>
    {
    return new HttpClientHandler()
    {
    UseDefaultCredentials = true
    };
    });

    .. all this still before I call builder.Build(); I have already googled and chatGPT'd the problem, but the solutions I get are for .Net 6 at best, and do not apply. My current solution is to use builder.Services.BuildServiceProvider().GetService() to get an instance of myConfig, but then the builder is called twice, so this instance is lost, and after the builder.Build(), I have to read my config again. Technically, this works, but it's ugly and triggers my OCD. If there's any DI god out there, what am I missing ? :) Thanks in advance Fred

    .NET (Core and Framework) json help question csharp dotnet

  • What's the Most Concise, Human-Understandable Practical Language?
    F Fred2834

    Hello, The question must be looked at from several perspectives. I would start by saying that if you give me 3 sliders to grade "practical", "concise" and "human readable", there is no way you will reach 100% on each, I would argue that not even an 80-80-80 is possible. Everything is a trade-off, and you will sacrifice in one area because there are things you definitely want to keep in another, and those things have a cost. It is up to you to decide which area you want to favor. Or rather, which language you want to support based on your style as a programmer. Then comes the question of the language's purpose. One should not compare a system language vs a scripting language for example. By nature, they have different purposes, have been build to solve different issues. One is compiled, the other is interpreted, and like it or not this has an impact on its design. Each area you suggest deserve its own debate, almost. "Human readable" for example. In your example, I would not want a very long hash table to be described without any special character. In the real world, large XML or JSON files are a reality. Imagine those without anything to identify what goes where. Tab separated ? or indentation dependent ? I personally think Python is an abomination for that reason alone, but there I am going against the majority, so let's avoid waking up the beast :) But you see, right here, by giving more focus to "human readable", you have already lost in practicality. Trade-off as I said. "Practical" : you mentioned "it has community, tools, …" => well those things are not the language itself, and they do not make it practical. The language itself should be self sufficient, you want to compare apples with apples. The fact that a language has a huge community is just showing its popularity, not its intrinsic worth. If I look at my own experience in scripting languages, I have done many, and I firmly believe that the best of them is Lua, but the world favors Python. So which is more practical ? Probably Python if you look at the community and tools, but I think it is Lua for the human-readable part. As for conciseness, I think it is not really the biggest problem. At some point, you have to tell the computer what to do. The real question is how much you want to work to get there. The real question is : "how much work should be accomplished by the programmer and by the compiler ?" If it is hard to write, it is probably easy to parse (think C++). If it is easy to write, it is probably hard to parse (

    The Weird and The Wonderful javascript python com game-dev tools

  • Sharing API's between multiple sites in IIS 8.5
    F Fred2834

    Oh I did not know ARR .. I will look into it deeper, but at first glance it looks like it could solve my problem. Many thanks ! :)

    ASP.NET sysadmin help html database windows-admin

  • Sharing API's between multiple sites in IIS 8.5
    F Fred2834

    Hello, I am trying to share a few API's between multiple sites on the same server (IIS 8.5). In a simple architecture, I would have each site on its own port, and each API on its own port, with the sites pointing to the API's they need. Unfortunately, we have a restriction that forces us to have the actual API's "under" the main site, by using "add application" in IIS, and using aliases for each API. This works fine actually. What I would like to now is to have other sites use the same API's, also by having aliases, but without physically duplicating the API's either on disk, or even in memory. Put simply, it looks like this: localhost:1000/index.html = site1 localhost:1000/aliasAPI1/… = api1 localhost:1000/aliasAPI2/… = api2 … and I would like: localhost:2000/index.html = site2 localhost:2000/aliasAPI1/… = api1 = same as on site 1, in the same physical folder localhost:2000/aliasAPI2/… = api2 = same as on site 1, in the same physical folder The reason being that site 1 is fully intranet, and site 2 will be visible from the outside world via junctions created somewhere else on the network, and where we want to enable only 1 port to reach site 2. I actually made a test simply by adding applications under site 2, and pointing physically to the same API folders, and it works, but it shows that the API's are ran twice in memory. Tried both in the same application pool, and in separate pools. Is there a way to really share the API's in a configuration like this one ? I've Googled the issue.. but couldn't find anything relevant :( Any help would be appreciated :) Fred

    ASP.NET sysadmin help html database windows-admin

  • Communication between 2 MVC API's on the same server
    F Fred2834

    The end game looks something like this: - One main API - Several smaller API's, mostly independant, but occasionally requiring to get data from the main API's in-memory repository. If I had had the liberty to do it, I would have used Redis or something similar instead of having one in-memory repo for each API, but it's not a possibility due to company standards etc.. That would have been easy :) .. because aside from sharing some data, my API's don't really need to communicate.

    Nathan Minier wrote:

    what is the exact nature of the communications that need to occur between the services?

    Smaller API's would just request info, and the main API would reply, never the other way around.

    Nathan Minier wrote:

    Is the communication simplex or do we need duplex?

    Simplex. Only from the smaller API's to the main API, never the other way around (otherwise I'd have seriously screwed up my architecture..).

    Nathan Minier wrote:

    What sort of update rate can we expect to see?

    The actual update of the data in the memory of the main API is not an issue, I already have a flip-flop mechanism that prevents delivering data while it is being updated. So basically anyone asking data is only getting it from the "active" part of the memory, while the "inactive" is being updated. Thus the smaller API's would also query from the "active" part. And I'm not managing TB's of data either :)

    Nathan Minier wrote:

    Do we need to acknowledge connection (like TCP) or can we fire-and-forget (like UDP)?

    Fire & forget could do (it's on the same server) as long as I can ensure that there is no data loss (which screams more TCP than UDP anyway :s)

    Nathan Minier wrote:

    Will you only ever have 2 communicating modules, or might you want to add more down the line?

    One main, multiple "clients". They're not truly clients because all API's would be autonomous and managing their own set of data, but the whole thing is related, and in time, we will want to cover more business areas, so we will definitely have more "clients".

    ASP.NET question csharp asp-net architecture database

  • Communication between 2 MVC API's on the same server
    F Fred2834

    Thanks ! I will dig deeper into the micro-services architecture, in fact, it's a bit my goal with each API. Good to know that WCF can be left out of the picture.. it was kind of everywhere when I googled looking for alternatives :s Fred

    ASP.NET question csharp asp-net architecture database

  • Communication between 2 MVC API's on the same server
    F Fred2834

    Hello ! I have a question about what the best approach/design pattern could be to achieve communication between two or more MVC API's on the same machine. Currently I have a single Web API delivering data to my web site. For reasons too long to explain here, we are refactoring the API to split it in multiple modules. One being the main API with the core information (think : Order database with detailed info), and the satellite API's having lists of orders, but without their details. Of course, when a satellite API gets a request, it could just reply with the list of orders (which it knows of), but I want it to reply with the details of each orders .. Important to mention is that all data is in memory, no database is behind the whole thing (otherwise it would be trivial). Knowing that all API's would be on the same server, and that I obviously want to avoid ping-pong between the client site and the API's .. I would like to have my satellite API ask my main API about this information. I have looked into WCF services, but I am not sure if that's the appropriate solution, and also about how to integrate it in my existing projects. I do already have the multiple API's running (not in prod) as normal ASP .Net MVC projects. In an ideal world, I would simply "expose" a few methods from the main API, so that the other ones can call it. I've also looked at the other ways to do IPC, but I am unsure which would be best in my case. Side questions about WCF Services: - do they have to be a project of their own ? or could I say that a few methods in my API are the actual service ? - What about the service reference that the client has to know of ? how do I specify where the service actually runs ? This is not necessarily known during dev, what if the server is hosted elsewhere ? - Do I have to care about async calls here ? Note: I'm obviously new to WCF, be kind :) Thanks a lot Fred

    ASP.NET question csharp asp-net architecture database

  • Managing XML Files
    F Fred2834

    Hello, The site I am working on gets its data from small XML files (a few KB) that are refreshed every minute by external tools. Knowing that multiple users will view pages, I think the best way would be to put them as static XmlDocument objects.

    private XmlDocument bodyStatuses = new XmlDocument (myfile));

    My first question is: knowing that the file will be refreshed on a regular basis, when is the "new" object actually created (pointing to the new version of the file, with new handle, etc..) ? Can I safely assume that ASP manages that for me ? Second question, in the same vein. When I use the same XmlDocument in multiple instances of a user control placed on the same page, could I also put my XML file as static in the user control ? so that it is only opened once (1st user control), and read once per user control ? I am OK in C#, but new to ASP, so I don't know how such things are handled internally, and I would not want to hinder performances with bad coding habits :) Thanks in advance.

    ASP.NET question csharp tools xml announcement

  • Interrupting service startup
    F Fred2834

    .. geez, should have thought about that! Thanks ! :-D

    C# csharp help tutorial question code-review

  • Interrupting service startup
    F Fred2834

    Hello, I am writing my first Windows Service in .Net (4.0, VS2010), and I am getting the results I expect, but there is one thing I would like to optimize, but do not know how.. and googlin' it has been infructuous so far.. Basically, I want to know what I have to write in the OnStart method to actually make sure the service does not go into "running" mode if something fails (ex: loading the config). It's all ok when everything loads well, but I have no idea how to abort the startup when an error is encountered. Any idea ? Thanks in advance, Best regards, Fred

    C# csharp help tutorial question code-review
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups