I'm coming from building Web-Interfaces from scratch (without any Framework, just HTML/PHP/CSS/JS) and I now try to "evolve". I really like using C# for all my recent projects which is why I found out about ASP.NET and Razor Pages.
I'm not sure if I understand them correctly, can I see Razor Pages ASP.NET Web-Applications as an "Application" we're used to? Which means, can I implement parallel working processing code while the user browses the site?
As an example, i plan to create a web-interface which shows continuous input data from sensors via Networking. Would this be possible, e.g. with a Thread receiving and processing data and then showing on the Website?
If not, what would the preferred framework or solution be?
I find all the tutorials to be to complex to find an answer to this question quickly.
Yes that can be done but using some technologies.To do so you can use SignalR to Notify the clients with the updated changes
Signalr:is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data.
https://www.asp.net/signalr
Then You can use WebAPIs for SPA or Just rest calls so as use can use the system normally and the server responds to your method execution async.
https://www.asp.net/web-api
Related
I'm planning to migrate a legacy ASP.NET Web Parts application to Blazor (most likely server-side).
I know that ASP.NET Web Parts won't be migrated to .NET 6 so I'm wondering if Blazor can offer something that can replace them. I need the end-user to be able to add controls to the page so every user can get tailored UI. The communication mechanism between the web parts was very important in the legacy application - for example a text box in one web part was used as filtering criteria for grid in another web part.
If Blazor can not provide replacement for ASP.NET Web Parts can you suggest something from React/Angular.
It's been a very long time since I looked at Web Parts, so I may be missing some features, but you can add and remove components dynamically in Blazor. That way, your users can set up their layout, and you can store the info, ready for re-creation next time they load the page.
As for communication between components, that's also pretty easy, as Blazor has SignalR built in. You can add a message broker to your app, and use that to pass messages around, much like MVVM messaging of you're familiar with that.
I'm not in front of my PC right now, so can't post much code, but if you look at this blog post I wrote a while back, you'll see how easy it is to do.
Hope that helps.
We released a WPF client server application this year . It has a client (with a few dlls ) and server on the server machine (with multiple dlls with most of our logic). The server side uses Entity Framework and the service between them is TCP /IP Windows communication foundation (WCF).
The client uses MS Prism with Mef for MVVM. The UI has a number of Datagrids for storing , saving data.
For WPF we have :
XAMl -> View Model -> Service Interface -> Server Side code -> DB
For ASP.NET , we expect to use the layers from Service Interface onwards as it is.
So , basically we need :
Website-> Logic for data handling on client Service Interface -> Server Side code -> DB
Unit testability is not a very major concern as our unit test coverage looks good on the server side (85 % covered).
I read up on ASP.NET MVC and found some tutorials that spoke about building whole applications on the MVC framework .
Our case we have more than half of the application built and only need the client side web UI with same data .
My question is : Should we go for ASP.NET Web forms or MVC ?
Web forms have native controls like GridView which can be used. MVC doesnt provide much native controls support . MVC covers the whole web app full stack. We only need the client UI website.
People around have recommended MVC since it is new and looks like the way forward but I am wondering if it would be overkill considering our requirements ( only need client). Would MVC force us to rework our whole layers even on the server side ? Will aSP.NET web forms not do this ? We want to be able to use WCF instead of doing any other http framework like webapi.
I know this question has been done to death with but these are some speicific requirements here. I also read up on porting WPF apps to Web but tat probably wont work out as we may have some fucntionalties different in the Web vs WPF.
Having worked with both MVC and Web Forms I would highly recommend going with MVC. In my opinion Web Forms is an antiquated pain-in-the ass that doesn't lend itself well to scaling or unit testing(which I know you said is not a huge concern).
Yes, Webforms has native controls like gridviews but you aren't missing out on much. These are good for very simple things but as soon as you add some complexity to your tabular data you're going to be pulling your hair out. What I'm trying to say is you can accomplish the same thing these built-in controls provide but with greater flexibility using simple tables or just plain old divs(and some css, of course).
I should also note that both MVC and web forms work just fine w/ WCF. You don't have to use WebApi if you're using MVC.
Lastly, I don't think there's an easy way of only providing "the client" piece of what your trying to accomplish with Microsoft technologies. If I understand your question correctly, you have a desktop application and now you want to provide a web-based equivalent UI. You're going to have to create a site using webforms or MVC to achieve that. However, you will be able to reuse your web services so you won't have to rewrite too much business logic.
You are making a small confusion. Since you have alredy a WCF(SOAP) backend service you will write only the UIClient, regardes of technology. You can do it even in Java.
Since you rewrite the desktop client, as a new web client you have to do it from scratch, and so should use ASP.MVC. You can find a lot of forums which can tell you why.
Web API is used, only if you want to create REST services in MVC. But you can build them also in WCF if you really need them.
The only good reason for ASP.NET, will the fact if you have developers which already know it, and you can save some money.
I have ASP.NET 4 Web Application that connects with SQL SERVER 2005/2008
I want to add a "chat" feature to my application users.
Supposing the feature will be built from scratch, what's the best efficient reasonable approach:
Using WCF web services with a Javascript timer every 3 seconds
Using ASMX web services with a javascript timer every 3 seconds
Using AJAX control from ASP.NET (Update Panel) and do a partial Post Back depending on an ASP.NET timer (server side) every 3 seconds.
Sending requests from the database to the application telling him to refresh himself when a new message is there (I don't have an idea about this approach but I think the technology exists, but I don't even know its name)
Some JQuery AJAX technologies that are outside Microsoft AJAX .NET Framework. these technologies should be able to communicate with SQL Server and be compatible with ASP.NET (Not PHP). I'm not sure about this approach.
Any other approaches or opinions.
Supposing the feature will be built depending on a previously implemented library. what are possible libraries that are totally customized and so likely to be open source. If the library will save 25% of the work time so that will be great, but I can't use a hidden code (blind DLL) if it's pretty critical even if it saves 80% of the work time.
Thanks,
You should look at SignalR - which is pretty good and less configuration required for it.
SignalR Project - http://signalr.net/
SignalR, Simple Implementation - http://rizwanahmed.net/?p=227
If you have more questions let me know...
Thanks,
Riz
We are looking into a better way to deliver data update notifications to a web front end.
These notifications trigger events that execute business logic and up-date elements via JavaScript (JS) to dynamically update the page without reloading.
Currently this is done with a server side thread, which timely fires an A-synch JS event to notify the web front-end(s) to check if the data has been changed or not.
This mechanism works, but the feeling within the team is that it could be a lot more efficient.
The tool is written in C# / ASP.NET combined with JS and we use the PokeIn library for the aSynch JS/C# Calls.
Any suggestions for improved functionality are welcome! Including radically different approaches still maintaining the JS/C#/ASP.NET usage.
Is this a real question? I would like to add this as a comment but I don't have the enough score.. Anyway, if you need what pokein does for you (object translation among the parties) that is the only option you have. Although there are solutions like websync, signalr.. They don't handle the object translation and has no different approach etc... Better, you benefit from pokein's websocket feature. Both of others needs Windows Server 8 for websocket. Pokein lets you use websocket on any server version or platform..
Sounds like SignalR would help you? This blog post gives a good introduction.
I was trying to solve something similar (reporting real-time updates triggered from an external services communicating with the server) recently and it turned out SignalR is a perfect fit for this situation.
Basically it is a library wrapping long-polling, Web Sockets and few other techniques, using (transparently) whatever is available on server and client.
I only have good experience with it so far.
Imagine a site where the user logs in and can view their ip webcam (I can do this bit i believe). The problem is i want the site to do some processing on the images/video coming in even when the user is not logged in i.e run some motion detection algorithm and if there is motion log the incident in a database.
What would i need to learn about to implement this project? I want to use ASP.NET and C# so i assume:
Learn ASP.NET.
Learn C# (I'm a pretty competent desktop application developer).
mySQL database (Is this the best kind of database to use in this situation?).
I've not used ASP.NET before hence i have no idea what it can/can't do. I think i can get an ASP.NET site up and displaying a live feed but how do i implement the bit that is always running in the background processing stills from the live feed and logging the incidents?
Any help is appreciated. Thanks in advance.
You probably want to use something like a Windows Service to do the continuous processing. With the ASP.NET site talking to the database and displaying the feed.
ASP.NET is not really suited to doing background tasks.
MySQL should work fine and is free, so if this is not a work related task then it might be a good choice. I have a MySQL database here that contains close to 100GB of text. So it should handle what you are suggesting.
The the web site and database you're on the right track, ASP.Net and MySql will work just fine for the type of project you are describing. However, the processing bit doesn't fit very well into the ASP.net model.
I would recommend that you think about creating a Windows Service to do whatever processing you need to do. It sounds like you want your processor to work on remote video streams so you'll need to consider how you'll get those live streams to you service and how many concurrent streams you could realistically process.
Perhaps it may make sense to have a client application or service that your users would run locally which would ping your hosted service when it detected a movement? In that case you'll likely want to look at hosting a WCF service which can be done in IIS or any standalone application (such as the aforementioned Windows Service).