Command remote machine from blazor PWA - api

I have a blazor wasm PWA with asp net 6 web Api as backend hosted in IIS (win server 2012r2). Now I need from blazor PWA to command some phisycal machine at different customer locations. From the App user need to show the current state of a single machine and modify machine parameters. So the App do the request for current machine settings, the machine responds with data, and the app can modify and save the settings to the machine. The PWA must be able to communicate with one machine at a time choice from a list. So the PWA communicate with Api and Api need to have a bidirectional communication with the client machine. Is this the correct way? Which technology is suitable for this purpose? Signal R (between the server and the machine)? Than you

Related

Cookie not recognized when switched domain between app services

I'm going to move sso server application (ASP.NET CORE DOTNET 6) from app service APS1 located in service plan AP1 to new app service APS2 located in different service plan APS2 (can't use Change service plan due to azure restriction on regions and resoruce groups). I cloned sso app from APS1 to APS2, added certificate and switch custom domain from APS1 to APS2. So after the change we have the same application, but located in another app service plan and another app service, under excatly the same domain. What I'm trying to understand is why cookie issued by app located in APS1 is not accpted by the same application, moved to APS2 under exactly the same domain which was switched from APS1. I tried to perform the same operation using sample app from https://learn.microsoft.com/en-us/aspnet/core/security/authentication/cookie?view=aspnetcore-6.0 but with the same results - cookie is not being recognized after switching domain from APS1 to APS2.
What helped was to set the same application name with:
builder.Services.AddDataProtection().SetApplicationName("appName");

Host two asp.net core applications on the same Ip and port (localhost:8080 for example)

I have two projects which are ASP.NET CORE servers (1 BackEnd and 1 Identity Server)
I would like the BackEnd to serve both apps on the same port and keep two separately runable projects.
How can I make this possible ? The purpose is to open only one port to the client.
Thanks in advance
I have two projects which are ASP.NET CORE servers (1 BackEnd and 1 Identity Server) I would like the BackEnd to serve both apps on the same port and keep two separately runable projects.
If your App(s) are hosted on IIS, you can try to deploy your BackEnd service and Identity Server in two separate applications under same web site as below.
Please note that the application's path would become part of the site's URL if we create an application in IIS. To make your Apps can work well, you may need to modify some code to include application's path in URL while you configure Identity Server to protect your BackEnd service.
In IIS, you need to set a binding for each web application. Then each web application will respond to requests for the corresponding binding.

Host Asp.net Core Web Api locally

I am learning Asp.net Core Web Api. I need to access the api from a flutter application but am not ready to host the api on Azure. What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
There are several ways to go about this, here are some options:
FROM VISUAL STUDIO: You can simply run the ASP.NET Core Web API from Visual Studio in Development Mode by Pressing F5
FROM COMMAND PROMPT: Run the API Project from the command line by opening a command prompt window in the root project folder of the project and use the dotnet run command. See here for more info about the command: dotner run command
HOSTING IN IIS: I am assuming you are running a windows OS. You can turn on IIS and its features. Simply follow the instructions on this page: Host ASP.NET Core in IIS on how to deploy ASP.NET Core to IIS. The advantage of this is that you have the application always running while you work on your flutter application locally.
I hope this helps you resolve your situation.
What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
If your application is developing now, there is no need to host the application and let the Flutter app client to access. We could build some json file as the right format like web api response to develop the client app.
If your client application and web api has now developed successfully, you want to host the web api to let fluent app or other application to access from internet. You should have a public IP address and host the application on IIS or else. Public IP address you should ask for the IP provider company. Without a public address, the client side app couldn't access your application from internet.
If your web api and the client app are in the same intranet, you could let the client app directly access the web api after the web api hosted on IIS by using hosting server's IP address.
About how to host the asp.net core application on IIS, you could refer to this article.

Ajax call to the Application Server sitting behind firewall

We have 3 tiered architecture:
Web Server - public (web application deployed) App Server - private (webApi deployed) Db Server - private (sql server installed) And my co-worker said, we have this architecture like this, because its a standard architecture that follows everywhere.
We have been using Asp.net application, where we can make api call from Web Server to App Server without any problem.
But now we have been converting our application from Server side to Client side, i.e. we'll only have js, html & css pages in web application, but problem is, we cannot call api using ajax directly from js, because of the two reason.
our App server is on different domain. App server is behind firewall, means it can only be accessed if we are connected to VPN, or we make a proxy on Web Server, and go through that channel. i.e. js<->Web Server Proxy<->App Server<->Db Server. We want to bypass Web Server from the channel, like: js<->App Server<->Db Server without connecting to VPN, because we don't require user to connect to VPN to use our web application.
Please give your suggestions. Thanks..
You have to enable CORS or cross origin resource sharing. You can research more on that but just want to give idea.

Authentication against Active Directory using a Mobile Device

I currently have a Mobile Application that communicates through a WCF Service to access a Database. The Mobile App can access on the network as well as externally. It connects to the WCF Service which is hosted on one server inside the network. From there the WCF Service is pointing at another server which is hosting the Database that the Mobile Device is accessing.
With the above process how would you setup authentication using Active Directory which would confirm the user of the Mobile Application before it can access the WCF Service to confirm that the user is a member of AD and they can then login after authorization is complete. This would occur as the user opens up the Application. Would this be coded into the App to prompt for the information, then send the information to the WCF Service which would then allow access? If not this then are there any other ways or information/links that can be provided please?
Take a look at the BUILD 2013 videos. Visual Studio 2013 will create a webproject that will automagically do all that for you (I think). Just bare in mind, it uses the Microsoft.OWin.Security beta packages.
Also...you will need to install the AspNetWebTools2013 package first...
http://www.asp.net/visual-studio/overview/2013/creating-web-projects-in-visual-studio#orgauthoptions