SignalR
6 TopicsBuild Scalable Web Apps and APIs with ASP.NET Core, Blazor, Angular for Modern Web Apps
I’m starting this discussion because many developers today need guidance on how to build modern, scalable web applications and APIs by combining ASP.NET Core, Blazor, and Angular—three powerful technologies within the .NET ecosystem. Whether you're focused on server-side development, creating dynamic client-side apps, or integrating both, these frameworks provide incredible capabilities to enhance your projects ASP.NET Core for API Development: ASP.NET Core is a robust, high-performance framework that allows you to create powerful APIs. Some of the best practices we’ll cover include: - Designing RESTful APIs with ASP.NET Core - Utilizing Entity Framework Core for efficient database access - Securing APIs with JWT and OAuth - Handling asynchronous requests for optimal performance - Implementing API versioning and changes over time Building Dynamic Web Apps with Blazor: Blazor enables you to create interactive web applications using C# instead of JavaScript. We will discuss: - Blazor Web Assembly vs. Blazor Server: Differences and use cases - Creating reusable Blazor components for UI - Integrating third-party JavaScript libraries with Blazor - Using SignalR for real-time features - Optimizing Blazor for performance Angular for Full-Featured Client-Side Development: Angular is a powerful, full-featured front-end framework that excels in creating dynamic and complex user interfaces. In this section, we'll dive into: - Why you might choose Angular over Blazor in certain cases - Using Angular CLI to scaffold, build, and maintain apps - Managing state in Angular with NgRx or RxJS - Connecting Angular with ASP.NET Core APIs for data handling - Working with Angular components, services, and routing for a seamless user experience Combining Angular and Blazor in a Single Application: You may have use cases where you want to combine both Blazor and Angular in one application to leverage the strengths of each framework: - When to use Angular for complex frontend features (e.g., dynamic forms, complex data visualization) and Blazor for simpler components or backend-heavy apps. - Managing communication between Angular and Blazor components in a single page (e.g., using - JavaScript Interop to pass data between the two). - Handling authentication and state management across both frameworks. Integration between Frontend (Blazor/Angular) and Backend (ASP.NET Core): No matter whether you're using Angular or Blazor for the frontend, integrating these with your backend API is key. We'll discuss: - Setting up HttpClient for making API calls from both Blazor and Angular - Working with SignalR to enable real-time features in both frontends - Managing authentication and authorization across both Angular and Blazor (JWT, OAuth) - Best practices for passing data and sharing state between the frontend and backend Scalable and Maintainable Web Apps: When building full-stack web applications, it's important to focus on scalability and maintainability. Here are some practices for achieving this: - Structuring your application code to separate concerns (e.g., services, components, repositories) - Utilizing Dependency Injection for flexible and testable code - Modularizing your codebase for easier updates and maintenance - Using Lazy Loading for Angular and Blazor components to improve performance - Leveraging Caching strategies to enhance response times Testing and Continuous Deployment: For any modern application, testing and deployment are crucial. We’ll discuss: - Unit and integration testing in ASP.NET Core, Blazor, and Angular - Automated end-to-end testing (e.g., with Cypress for Angular, bUnit for Blazor) - Continuous Integration/Continuous Deployment (CI/CD) strategies for seamless deployment to cloud platforms like Azure or AWS When to Choose Angular, Blazor, or Both: It’s essential and interesting to know when to use each of these frameworks depending on your project’s needs. Some scenarios we’ll explore: - When to go for Blazor for a unified C# experience in both frontend and backend - Why you might opt for Angular when building highly interactive, feature-rich web applications - Hybrid approaches where you can use Blazor and Angular together for a robust full-stack solution SO: Combining ASP.NET Core, Blazor, and Angular allows developers to choose the right tool for the right job, creating flexible, scalable, and maintainable web applications. Whether you’re leveraging Blazor for its deep integration with .NET or Angular for its powerful frontend capabilities, these technologies offer a powerful suite of tools to build modern web applications. What are your thoughts? How have you integrated Angular or Blazor with ASP.NET Core in your projects? Share your experiences and challenges, and let's collaborate on solutions!533Views9likes5CommentsAutomatic UI updates with Blazor
Starting with the new .NET 8 Blazor WebApp template, I hope to build an application whose pages automatically send updates to all users. For example, when Joe adds a payment to an invoice, Sue (who is viewing the same invoice) should see the new balance reflected on her screen the moment Joe clicks the Save button. Will this be possible without wiring up a special SignalR hub for each page/component? I've read that Blazor uses SignalR under the hood, so I'm hoping this can be accomplished without a lot of complex (and error-prone) extra work.242Views0likes0CommentsThreading problems in SignalR Hub
Hello, I implemented a SignalR Hub to make a game server. The idea is that when a room is full (4 people in it) I run a new game. A game: 1. We notify everybody 2. The first player send one data. 3. We switch to next one 4. while the game isn't finished: Ask the current player two data. Switch to next player My problem is that with that simple system, once the client sent the data, the server do nothing, that's why I think there is a data race somewhere that I don't see. Here is my https://github.com/mehdi-arch/okeygameserver in OkeyServer/ you have the server code, in OkeyScript/ you have all the functions needed for game logic. Thanks in advance for your help.312Views0likes0CommentsDeploy .net core 7 to IIS with SignalR
I am using .net core 7. I enabled IIS on my local pc. then publish the files to the inetpub folder, and configured everything. the http requests are working and I can see the website on localhost:5151, the problem the SignalR requests not working,and I dont know whats the problem and how can I solve it? on visual studio everything works as expected. also installed the dotnet 7 hosting bundle... I tried older solutions that I saw here on stack overflow like updating the web.config file without luck452Views0likes0CommentsBlazor static server render
I created a Blazor static server rendering app in dotNet 8. When I render a page there is no web socket connection but two web sockets automatically connect after reloading the page. The web socket name is "BlazorServerPerPage" and "connect?transport=webSockets&connectionToken=AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAAKC3HxdpWzk%2B%2Buzj%2FyAY8AQAAAAACAAAAAAAQZgAAAAEAACAAAABlb6W2gebcz78%2Fr%2F8shdCSzutFva74Ke%2FWv3BrboDhdAAAAAAOgAAAAAIAACAAAABmEpDtT%2Bp9g9AticccUyPGcVKJX8D2iHRAii00Y4HI4TAAAAD4IuGqYb7yHY%2F6vv7wVeVoZ6XxScT0lGAuIotgwoZDUBT44PKC1QhbJz4Zp6tztS5AAAAA5Hs05w4IauJrFWjLgFzo0zF8pj1dr6MFFwdCFS1Ew3Wtky7%2FKc1%2BSZNvmfqA%2B8%2FCsENStCDrLbjRwoLpj%2BcL8Q%3D%3D&requestUrl=https%3A%2F%2Flocalhost%3A7157%2F&browserName=&userAgent=Mozilla%2F5.0+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F119.0.0.0+Safari%2F537.36&browserIdKey=window.browserLink.initializationData.browserId&browserId=e114-ee35&tid=7". I think it's not supposed to happen. My app setting is "var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorComponents(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAntiforgery(); app.MapRazorComponents<App>(); app.Run(); " So my question is, is It a bug? Please help me with the question ans.457Views0likes0Comments