How to configure middleware inside a .NET MVC 5 Web App? - asp.net

I need to run a program that fetches info from a REST API every 10 seconds and then posts it to an Action in my MVC 5 Web App.
So far, the best solution I've come up with is to run the Web App and then, parallel to it, a Console Application that works as this middleware, fetching the API and Posting to the Action on the Web App.
I figured a better solution would be to execute the code that powers the Console App directly inside the MVC 5 App, this way only the Web App would be executed, and the code could work on the background, fetching and posting the data.
I noticed that when you create a new project, and select Console Application, you can add it to an existing Solution. Would this enable the behavior described above?
How can I achive this behavior on the ASP.NET MVC 5 framework?

Related

Merging Angular 6 based web pages with legacy ASP.NET web portal

I have a .NET 4.0 based plain ASP.Net legacy Web Portal. Now, i have some new requirements for which i am planning to use Angular 6. Rewriting existing .NET based web app to Angular 6 would require huge effort. So, I am thinking to create new pages in Angular 6 and integrate with existing ASP.NET application. Before trying this approach, i want some suggestions on how to integrate ASP.NET server side application with Angular client side pages.
Sharing your experiences on similar approach, suggestions, recommendations are always welcome.
The problem is that Angular is a SPA or single page application style of development where ASP.Net legacy renders a new page with every post back operation which will destroy an Angular app instance. Any time you need to navigate to pages in the APS.Net app you will lose your Angular app and need to reinitialise it every time you route back to anew page.
Maybe you could iframe the old pages and hide the Angular SPA each time you show an old page so you can keep the SPA running.

How to implement SignalR in ASP.NET web API project with Angular 6 front end

I already created a ASP.NET web API project and separately created Angular 6 project and connected 2 domains with CORS. Now I just want to add SignalR to get user notifications in the database update of a certain table.
EX: when I add a new user to the system existing users need to notify a new user added in real time.
I created another ASP.NET web API project in the same solution in Visual Studio to implement SignalR and I have no idea to connect those projects.
How to implement SignalR functionalities to get real time notifications. Please give some explanation with code snippets.

A way to publish ASP.NET 5 to Azure Cloud Service?

A noob's question. I consider using a Cloud Service instance to host a web-app, but my app is based on ASP.NET 5 beta8. Visual Studio tooling doesn't allow me to add an ASP.NET 5 app into a Cloud Service project (which could make it trivial to deploy).
However, it is still just an app. So there must be a general way to put it in, right? Or is it possible only through VS tools?
Your question is a duplicate of: How to convert a ASP.NET 5 Preview Web Project to Cloud Service
The answer in that thread:
It's not supported yet. But, if you want, you can create a setup script that installs all the needed components and then you can follow the steps from this post to run it and bootstrap your app: http://www.codeproject.com/Articles/331425/Running-an-EXE-in-a-WebRole-on-Windows-Azure

How To Debug Web API Project From MVC Project In Same Solution

In VS 2012, I am attempting to create an MVC 4 web application with jQuery calls to a Web API project. (Other devs will be consuming the API with our current, native app, and probably adding to the API in the future.) So I have one project that is the Web API, and another project that is the MVC 4 website. I can only set one of them to run, and they use localhost:xxxxx.
How do I debug changes to both? For example, let's say I add a new API path /api/customer/get and then a new jQuery ajax call to that path and do something with the resulting JSON. I've changed code in both projects and want to follow it end-to-end; how do I launch both? How do I debug both?
Just to be clear, the MVC app isn't making server-side calls to the API, I'm using MVC mostly to be able to easily use bundling, minification, and (hopefully) pre-compiled Handlebars templates in .NET; the API calls are coming from jQuery. As I am still relatively new to these technologies, alternate suggestions are welcome.
Thank you in advance.
I had the same problem and have found a solution from here:
forums.asp.net
The fix is to do the following:
In your solution file, click properties go to the Startup project node (if it is not already selected)
Next select Multiple startup projects. Select your website and your webservice and in the Action column make sure both of them have "Start" selected.
Now when you debug your website and put a break point in your webservice, it should hit the break point.
Coming late to the party but in case anyone else is looking for a solution, this is what was best for me: Set the Api project up to be the starting project (I needed to limit to one startup so that I could flip between browsers more easily). After firing up the service project, right click on the web/ui project and select debug, start new instance. You'll have both running and you'll seamlessly step from web to api.
I had a similar problem with my web api project. My solution consisted of an angular front end with 2 web api projects on the backend. One web api project handled "authorization" and the other handled "resources". I used the following tutorial by Taiseer Joudeh as a starting point:
http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/
Breakpoints worked on the "authorization server"... but not on the "resource server". I compared the packages from the two projects to see what was different. Once I added "Microsoft.AspNet.WebApi.Cors" to the "resource server" project, the breakpoints starting working.

how can we integrate meteor application to simple web application runs on application server?

Is there any integration meteor application with application server.
I want to create a chat client which should be integrated with my web application, i have seen meteor example and i want to explore the possibility for my requirement.
Please suggest.
You could either use meteor for your web application or you could put the meteor chat application in an iframe on your web application.
It would be difficult to actually integrate your current web application into a seperate meteor instance because meteor includes its own webserver and the meteor code can't run on what your application server's stack might be (IIS/Apache,Thin,etc). You would have to look at a way of having meteor run on its own and then integrating this into your webpage with html/javascript
If you don't have a chat application on meteor yet, there's a very good example at:
https://github.com/AVGP/meteor.js-chat-example

Resources