How to run windows service on Linux or Mac OS [closed] - c#

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 1 year ago.
Improve this question
I have created windows service and it is working fine on Windows OS ,but we need to run this same service on Linux or Mac OS.
It is possible ?

Linux or macOS has its own way to manage "services", via systemd or supervisor or other mechanisms. Thus, you won't be able to ship the Windows app to such platforms, but you can write a .NET Core console app based on the same logic and then put it under systemd or the desired tool on such OS.

Obviously "possible", in the worst case reprogramming from scratch. I'm guessing the winforms tag you've used suggests what you think the biggest porting headache will be. Maybe check out C# WinForms application to linux which seems to be asking that same question. An even easier approach might (emphasize "might") be to run virtualbox https://www.pcsteps.com/184-install-virtualbox-linux-mint-ubuntu/ (or see many similar pages, and many similar vm's) under linux, and then just run your service on a windows virtual machine.

Related

Does it make sense to work on a c# project, for a windows server, developing it on linux? [closed]

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 2 years ago.
Improve this question
I'm a PHP/JS developer, now I have a proposition of making a project based on C#, which would then work on a Windows server.
I have no experience with either (C# or Windows server) but I was given some time to learn it, if we agree on the details.
The project is about an API (web service, RESTful).
And now I have two questions - I haven't touched Windows for about 10 years, so:
Am I right that I have to learn C# and the .NET framework? Is the .NET some sort of standard on MS servers?
Is this reasonable to work on the project using Linux machine as the work environment and then upload it to the Windows test server for testing?
BTW, right now the project is very simple, probably only a few classes. If I'll make it, I can later install Windows on my workspace, but for this very small project, where time allowed for the implementation is about one day (excluding my learning process) I would prefer to avoid it.
C# is a programming language, .NET is a framework. There is an old .NET Framework that is windows only and the newer .NET Core (the newest version is called just .NET 5), which is cross-platform.
You can develop .NET core apps on linux as well. Note that you won't be able to use Visual Studio (IDE), which is only available for Windows and Mac.

Should I make my application a service or a console application? [closed]

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 2 years ago.
Improve this question
I am planning to write a web server in c# that will run on my computer. I've heard that windows services are good for such tasks because they can start on startup and because they run in the background and don't interfere with your work. The only problem with this is that I would like to see the activity on my web server through a terminal. I don't think services can do this, but it's not a big problem because I'm sure there is a way to make the service run the server and create a separate console application to interface with the server service.
My question is, why bother? Can't I just have a console application run everything and also handle the terminal interface? The only reason I would consider using a service is if it offers some kind of performance boost. Does it?
Windows service - is not about performance boost. Your choice depends on what is the main goal of your service. If it's just an utility app and you plan to start and stop it manually perhaps console app will be good for you, else IMHO you should consider windows service that store logs and/or push events + console/wpf/winforms or any other appropriate kind of application for monitoring purposes.

.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.

creating Linux app from existing wpf program using xamarin [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 6 years ago.
Improve this question
I'm having a program created in wpf (using MVVM pattern) and I want this to work in linux too. I read about xamarin but couldn't find any tutorial how to implement such thing. Can anyone explain if it is even possible to somehow use my existing program with xamarin (in visual studio) and run it on Linux? And if so, how should I do this?
Thanks :)
You don't need Xamarin to develop a Linux desktop application using C#. With MonoDevelop (Xamarin Studio was originally forked from this project) you can develop GTK# applications that could be suited for your needs.
The problem with WPF is that Mono (the open source implementation of .NET) is only a subset of .NET and doesn't have any implementation for WPF, nor does it have any plans to implement it.
So the takeaway from this is that you can still reuse almost all of the core code from your existing application but to make it run on Linux you'll have to rework the UI layer.

Is there one API to handle the Task Scheduler in XP and Vista? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 14 years ago.
Improve this question
I have a couple applications that I would like to be able to add scheduled tasks from within them. I've been Googling for how to add tasks in both XP and Vista. Apparently, Vista has a new Task Scheduler that is very different from the one in XP.
Does anybody know if there is a single API to tackle both of them, or do I have to code for both in my apps?
I think you could use the Task Scheduler COM interface.
Also check out this project.
If I recall correctly, the initial release of Vista used the same API as XP.
Server 2008 is supposed to have a much improved scheduler. That would seem to indicate that the API has changed.
I mention 2008 because SP1 for Vista brought much of the code in line with Server 2008.
Good luck and I'll be watching other answers.
Ideally, you could use the interface on the OS you're currently running on. You could do this by having an XP and Vista version of your app, for instance.
But Vista is from Microsoft, so the old API is still there for programs to use. The simplest solution is to use the XP API for this version of your app, and require Vista, Server 2K8 or better in the next version or perhaps 2 versions from now and transition to the Task Scheduler 2.0 API then.
Just as I suspected. I will have to code to two different APIs then. It will make maintenance harder, but not impossible. Just need to make sure that I put integration test that cover both cases.

Categories

Resources