Long running process in ASP.Net MVC [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
We have a long running report which is now scheduled using Reporting Services. This report runs around 40 minutes and produces a csv report of around 10 MB of data. We are now building a new Asp.Net MVC app and the user wants us to bring this long running report into ASP.Net MVC and retire the Reporting services. Initially we thought of doing it with Task.Run/HostingEnvironment.QueueBackgroundWorkItem but we moved away due to app domain recycle issues and we do not want our worker process to take this load.
Currently, we are planning to build a command line C# exe which can run the stored procedure and prepare the CSV report into a shared folder. We will then have a ASP.Net MVC view from where user can initiate the command line exe through system.diagnostics.process.start() method. The ASP.NET MVC will show the report as downloadable link once the process is completed. We will have a status DB table which the exe can update the status once the process completes and the Asp.Net MVC view can use this to display the status and downloadable report.
Is there a better way of handling this requirement? Thanks in advance!
Regards,
Bala

I would go for the Windows Service approach. The main reason is that you can keep an eye on how many instances are running at the same time and throttle it if you need to. You don't get the same kind of control with an exe. Use the same status approach, that will work fine.
You are right to keep this out of the Web App, you really don't want to put that kind of pressure on it. You could even run the service on a different server to keep the web one lighter.

It's a valid-enough approach, I think. However, running an EXE requires a full trust environment, which is generally not a good idea. Personally, I would use something like HangFire, instead.

Related

Use Angular with an existing Asp.Net Website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on a project where we already have an existing website built using Asp.Net. We are planning to add some new pages and update some existing one.
I am planning to develop those new pages in Angular 5 with Webpack. We can not convert the whole website into Angular due to budget constraint but ultimate goal is to convert in completely in Angular 5.
Have anyone worked on such a hybrid app in recent future?
Can someone please throw some light on it, whether it is workable and If there is any performance impact due to mixing up the technologies.
Yes I'm working in a similar situation, and it's definitely possible. An .NET page (MVC?) can return an Angular SPA and take control of the UI flow from that point on.
Say you want to start by creating a "User Profile" page in Angular. When the user navigates to that page in your standard MVC site, it should return the page with the Angular application loaded (as a javascript script reference). From there on, the Angular app can handle further redirects and logic.
It does make some things complicated, but it's usually not feasible to port things in one go. This approach has allowed us to move over to Angular, 1 page at a time.
We at a large company have done exactly that. It is very simple. Using angular-cli create a new project
ng new my-project
and copy the contents into the root of your existing ASP.NET solution. You will now need to use
ng build --watch
instead of
ng serve
and copy the script includes from /dist/index.html into your aspx or cshtml file.

.Net Core, Web App Executes Console App [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a .net 2 Core web app on windows IIS. No issues with the web app. How can I successfully run:
1) a .net core console app;and
2) a regular windows executable?
The console app is needed because of the work passed to it can take several minutes - sometimes up to 10 minutes to complete. Probably too long to expect a user to keep their browser open.
I have tried using "System.Diagnostics.Process" on the windows app with much success. I figured before I started trying with the Core app, I would get some suggestions. Let me know if any additional information is needed.
Console app in .net core 2 has a lot of new features in it, explaining it in a nutshell is a little bit complicated.
I would suggest starting from this
guide
on git hub which sums it up really good.
I would also recommend looking into this post regarding Windows Executable (which is about .net core 1.0 but is more or less the same) and this article.
Those will be a good place for you to start.
I'm not sure if this will be useful, But you can try the task scheduler to call the app. Gets rid of a lot of permission problems.

c# notify a running process [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to somehow notify a running process from the "outside"?
I have a C# program that theoretical runs forever. And I would like to notify it to trigger some action manually. It would be best, if this solution is possible on Windows and Linux (mono).
EDIT:
The solution should work without a user interface
My program is, as for now, a part of web service. On initializing, a new Theread is created, which uses the Task class to stay alive
Take your forever-running-process and let it provide a webservice other processes can call.
You might use any cross-plattform webservice framework like WebApi or ServiceStack to achieve this via HTTP calls. This will even work over the internet (if the machines can reach each other).
There are dozens of approaches. You could also use named pipes for example, or put commands into a database (the other process has to query regularly) or - if you're fearless enough - write/read files to communicate. Be creative ...

Configure WebClient to speed up download [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What I am doing
I am trying to migrate Classic Asp app to ASP.NET MVC. Classic App was written for 15 years. There are no chance to write new project and migrate all code at one moment. Business app must work 24/7.
What solutions I have found
I did not find any good solution. One advice I have found starts with words "I feel your pain, bro". Business can not give such human resources for global refactoring. So the only way I found is to write some kind of proxy using WebClient.
Architecture
I have server with IIS that hosts Classic ASP app. I will add MVC app near it. Every request received by server will be managed by MVC project. If there is action that request asks - MVC app will work as normal. Render view, return to client. If there is no such action Controller will call Classic ASP by using HandleUnknownAction method.
So it will do some work by processing url and cookies and in the end call Classic Asp app by WebClient.DownloadString(). The return string (HTML response) it will embed as content to the page (Headers, Footers are in MVC Layout). Need to mention - project is not highlighted but near it.
So I can migrate old code by small pieces. Action by action with no impact on application. Just by creating action methods in MVC.
Requirements
Response time will grow significantly.
There are no alternatives.
Question
I want to know every possible chance to speed up such web app. Maybe by tweaking WebClient configuration or so. Are there any settings to do this? Maybe some advices to manage webclient pool? I do not need to make cross server requests - does this open any abilities? Maybe this is the place for async calls? Or reorganize server structure?
Thanks for any advice!

Email Newsletter [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am working on a newsletter. Newsletter content is saved in the table along with frequency such monthly, weekly, daily. Newsletter also have start date. What I have to do is based on the data and frequency. Newsletters are emailed to all the subscribers. My confusion is that whether I need to write a sql server job for this or simply asp.net can do this. If yes then how would I be able to do this.
As your web application will be terminated in times of inactivity, you usually have a service or task scheduler run such periodical tasks. Also your web application is responsible to return requests quickly and should run with a very limited set of permissions that might not be enough for your jobs (it is preferable not to allow the app pool account to send e-mails to lots of accounts).
There are various alternatives that differ in terms of convenience and deployment of your application.
An important requirement besides the capability to run jobs periodically is how you can trace errors in the job, so you should think about your logging strategy before the first problems arise.
Besides writing a SQL Server job, you could also:
Create a console application and use Windows task scheduler to run it periodically (interval is the minimum of your scheduling options, in your question daily). This is easy to implement, but requires some steps to deploy it to a computer.
Create a dedicated windows service that is installed to the computer. While this requires more effort to create and test the service, you can also create an installer to simplify the deployment.
I eventually went for the application events. I set the timer in application event and it works similar like jobs and windows services.

Categories

Resources