When writing Blazor WASM applications, we can use async/await in C# code.
But how exactly task scheduling is implemented running in a WASM sandbox? I guess that it has to be somehow integrated with a JS event loop.
Related
I am creating a cron job using .Net Core which will fetch data from API and insert data into database.
Should I use ConfigureAwait(false) while calling api in asynchronous mode?
I am confused after reading article - ConfigureAwait(false) relevant in ASP.NET Core?
Since I am having console app not a UI app so Please suggest Should be go with ConfigureAwait(false) or not
In short: if you are asking, then you don't need to use ConfigureAwait(false) in your application.
.NET Core framework has no SynchronizationContext. So in this contextless approach from .NET Core, the default asynchronous behavior is the same as we have, when using ConfigureAwait(false), so when an async handler resumes execution, a thread is taken from the thread pool and goes the work.
Source: https://itnext.io/a-deep-dive-into-configureawait-65f52b9605c2
I want to develop an SPA project by Blazor technology.
Due to complexity of debugging the Blazor Web-assembly application, I would like to first create it as a server-side app, and then later change it to a Web-assembly application app.
Is this possible? If so, after I have successfully gotten the Server-side Blazor project to work, what changes will I need to make, to get the same functionality working with the WebAssembly project?
Also, are there any particular approaches or technologies I should avoid in my Server-side Blazor project, because they have no equivalent when using WebAssembly?
For the most part, your Blazor components should be able to migrate from Server to Webassembly with few or no changes.
If your Blazor Server application doesn't require data from outside your application (e.g. database calls), and it doesn't use any APIs that aren't supported in the browser (e.g. System.Security.Cryptography), then you may be able to migrate to Blazor Webassembly without any changes to your components.
If your Blazor Server application does require data from outside the browser, then those services will need to be hosted elsewhere and called from your components via Http requests (see Call a web API from ASP.NET Core Blazor).
There are a couple of good options for your Blazor Webassembly back-end, the most common of which is the Blazor Webassembly hosted template.
If you'd rather serve your Webassembly app as a static web application, you can instead move your back-end services to a serverless function application. There are a variety of options for that, the most convenient of which (in my opinion) is using Azure Static Web Apps with .NET and Blazor
I work with asp.net.
I want to write realtime application without ajax polling.
I need free technology - something like node.js and socket.io.
What is the alternative for asp.net - NODE.JS and SOCKET.IO?
Check out SignalR
Async signaling library for .NET to help build real-time, multi-user
interactive web applications
Asynchronous scalable web applications with real-time persistent long-running connections with SignalR
Learn how to use SignalR and Knockout in an ASP.NET MVC 3 web application to handle real-time UX updates.
Fun with #SignalR
Why not use httplistener/tcplistener? It's in the BCL and is a part of an ECMA standard. So, I guess you can say it is free? No?
I've used AspComet in the past.
Source code: https://github.com/nmosafi/aspcomet
Overview: http://neilmosafi.blogspot.com/2010/11/aspcomet-high-level-architecture.html
I'm trying to write a client app using monotorrent library with asp.net.
there is a clientapp sample provided by monotorrent but since I'm using asp.net I need to know how to keep the engine running all the time and get feedback, like download rate and ..
I tried to use the Task class provided in .NET 4, but the thread keeps shutting down randomly ( I think of course ).
Is there a way that I can keep the thread which engine is running in, always working?
or any idea on where to look for implementing the client in web app?
Thats impossible, as the ASP.NET worker process is recycled from time to time. What do you need is a desktop application or a windows service. And then build an WCF service to communicate with you ASP.net application.
Are there any caveats or short comings to using the new Task API in System.Threading.Task in ASP.NET hosted under IIS?
I know prior to .NET 4.0 working with any of the ThreadPool actions inside of IIS was always recommended to be avoided.
Any caveats to using ThreadPool with IIS would still be valid using System.Threading.Task, as the Task API is just an additional layer of abstraction over System.Threading.
For long-running tasks in the background, I use a ThreadPool inside a Windows Service. This keeps it outside of IIS.