serving the solutions day and night

Pages

Showing posts with label .NET Core. Show all posts
Showing posts with label .NET Core. Show all posts

Tuesday, August 25, 2020

Deploy ASP.NET CORE application with the Kubernetes Deployments

Update the application with a rolling update strategy that releases new pods more gradually, one pod at a time. 

Roll back the application to a specific version of the deploy history using the deployment. 

Run the command without --restart=Never (Deploy ASP.NET Core Application images in Kubernetes (K8s) & POD). Command to create a simple deployment 

 kubectl run frontendmvcv1 --image=makader/myapp:frontendmvc-v1 --port 80 

kubectl get deployment frontendmvcv1


Sunday, August 23, 2020

ASP.NET Core SignalR Chart Hub Application using Chartist.js

 https://gionkunz.github.io/chartist-js/

https://github.com/mkader/SignalRExample
 
Real time Chart Application Use Cases
  • Real-time KPI (key performance indicator) dashboard of sales figures, 
  • Stock market price ticker 
  • Shared calendar scheduler
  • Notification dashboard (like doctor in/out for a hospital ward)

ASP.NET Core SignalR Application

https://github.com/mkader/SignalRExample

Create a new ASP.NET Core (3.1 or later ) Web Application (whatsupchat) with HTTPS

Add the JavaScript SignalR Client Library.

ASP.NET Core Main Method

 namespace whatsupchat
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });
    }

The Main method is the entry point (where execution will start) when the application starts running. 

The Main method is used to create a host builder, specifically a default builder. 

A builder, knows how to create a web host. 

The default builder also sets up some of the default services behind the scenes, to configure application using the Startup class (webBuilder.UseStartup<Startup>()). 

Build() the builder, gives us a web host instance that knows how to listen for connections and process/receive HTTP messages. Finally, the web host to Run(). 

Once we call Run(), everything that happens in the application is determined by the code that is contained in the Startup class. 

ASP.NET Core now knows that it’s going to instantiate the Startup class and invoke two methods. 

The first method is ConfigureServices, will allow us to add our own custom services in ASP.NET Core. This will then inject those services into pages, controllers, and wherever else we might need them. 

The second is the Configure method, will determine what middleware it will execute for every incoming HTTP message.  

The request pipeline comprises of a series of middleware components. Each middleware component performs some operation on the HttpContext, and then invokes the next middleware in the pipeline or terminates the request. 

Can create custom middleware components. 

ASP.NET Core SignalR

https://github.com/mkader/SignalRExample
The ASP.NET Core SignalR repository on GitHub.

SignalR is an open source library and allows developers to simplify adding real-time web functionality to applications. 
"real-time web" functionality means that the server-side code can instantly push content to connected clients.
Examples
  • Chat applications
  • Notification applications (Team meet, share ideas)
  • Live dashboards (display instantly updated sales information).

Sunday, August 16, 2020

Access ASP.NET Core MVC Application with Kubernetes and NodePort

Execute the command "kubectl describe pod myapp-rc-wl284",  each of them is running on a specific IP, internal to the node.  

The Node IP (192.168.65.3), but you can’t access it directly because the forwarding rule to send the requests from the node IP to the pod IP is missing.

ASP.NET Core Application with Docker

Create new ASP.NET Core MVC application through Visual Studio with Dockerfile.

OR Using Visual Studio Code, type "code .". Install the VSC extension named Docker by Microsoft, which help us to edit the Docker files.  

OR Create by .NET Core CLI

Create new folder c:\frontendmvc, use powershell to run the below commands

  • mkdir c:\frontendmvc
  • cd c:\frontendmvc
  • dotnet new mvc 
  • dotnet run