I have (or the company) a simple watchdog application that monitors memory, diskspace and some connections and other stuff realated to a realtime database server. We are using this application to detect errors and notify system administrators by email about faults. We also send a daily report on som KPI and other stuff.
The problem is that there need to be someone logged inn to the server at all time with this solution (it was created simple just for monitoring some problems we had but has become a application we like to futher develop) and we like to convert it to a service to avoid that someone needs to be logged on at all time.
The application is written in C# framework 3.5. I know there is WCF and other stuff now. I looked in VS (version 2012) and i see that the even removed the Service project that used to be there, and there is now only WCF.
I dont have to much experice in that field (.NET technology) since i've only done legacy C++ programming the last 5 years at work.
Does anyone have som recommandation for doing this the best way ?
If you move all of your logic into a class library, you can just create a new Service Project, and use that library within the service that's generated.
MSDN has a walkthrough on creating services that walks through the process, step by step.
Related
first question after 7 years being a member and about a century being a parasite just taking the goodness of everyone elses answers!
I have an extensively developed and complex windows application written entirely in C#. It is networked using a UDP socket for discovery and then a WCF style service that can be either self hosted or discovered. This is working just fine and dandy.
While the entire process in this application can be handled by one very skilled operator, it is definitely advantageous to have some lackeys do the simple tasks - and I mean there's some really simple tasks. In the past this was achieved by printing a report and having the lackey go around and tick the list, and report back when everything was accounted for. Now there's a fairly simple screen that does the job well. "Tomorrow" I want to give the lackey an iPad with a 'lite' version of the application that only performs these select single functions. The biggest complexity is that the iPad needs to know live of any changes to the list that happen on the 'master' computer, and the 'master' computer should know when the lackey completes the list. This happens in the simple screen I've got, but obviously was a problem with the report, and in practice I've noticed the client base don't have a heap of computers to be using so they almost always fall back to the report-based process.
I am currently refactoring the main application for a new major version and changing a few things around, so I'm evaluating my options for the networking functionality.
I found this answer that talks about "Simple Client Server" (SCS) library to do Remote Method Invocation which looks like a perfect replacement for my WCF service in the windows-to-windows scenario, and it looks like I could adapt it into an iOS app (it'll be in C# after all). This project is quite old though and doesn't really help me work out the iOS side of things (maybe I'm lazy, maybe it's having twin babies).
My toolset is Visual Studio 2019 using C#. My existing application is WPF for the visual wow abilities, but really the UI is not at issue here. Architecturally I have a sync service class that will run on the 'master' application and all clients, including the one on the master, will go through that service to perform data operations so I have a single point to jam in what I need. I have been .net'ing for 15+ years, but this will be my first attempt at the iOS project in Visual Studio.
I am aware I could use the existing UDP discovery method to find the server and then write RESTful services, however I want the companion app to be live and receive event notifications and this doesn't seem like a very efficient way of doing that.
For gamers out there, Bethesda released a companion app on the iPad for Fallout 4 which is exactly the concept - on the iPad app you can interact with your Pip-boy, see the map, change your inventory around, but you can't actually play the game from it.
Does anyone have any guidance, specifically or in general, as to how I might go about writing a "companion" app using my toolset that can easily talk to my windows app?
I have an old MFC app written in Visual Studio 6. This will at some point be rewritten in C# .NET. However, before then I have to write a couple of new Windows services for the existing application. The others were written in ATL. What I would prefer to do is write these new services in C# .NET so that when the rest of the application is rewritten, these don't need to be.
Is it going to be possible to call the interfaces on the libraries hosted in a .NET windows service from the old application? If so, could you please explain how.
Absolutely. You're looking for a feature of .NET called COM-Interop.
http://msdn.microsoft.com/en-us/library/kew41ycz%28v=vs.71%29.aspx
http://msdn.microsoft.com/en-us/magazine/cc163494.aspx
The second link has an ATL example.
EDIT:
Based on your feedback in the comments, let me expand on this...
Ah - you're right about the sample on that page.
The first link is really where you want to start for all the details. If you follow the links, you'll find this page:
"Exposing .NET Framework Components to COM"
http://msdn.microsoft.com/en-us/library/zsfww439%28v=vs.71%29.aspx
Essentially, it's just a matter of applying a series of attributes to your classes and properties, and then generating the appropriate registry entries on the client machine (which .NET has a tool to do - see: http://msdn.microsoft.com/en-us/library/bctyca52%28v=vs.71%29.aspx)
I've done this several times myself for .NET projects people needed to call from VC++ and/or VB6.
Some other links that might be of interest:
http://www.codeproject.com/KB/COM/nettocom.aspx <-- Perfect example of what you're trying to do.
http://www.codeproject.com/KB/COM/Universal_CCW.aspx
I've done this exact thing with an MFC-based C++ application in Visual Studio 2008 and a .NET-based C# Windows service.
First, if you have not created the C# Windows services yet, I've got a couple of tutorials for creating the basic framework. The first tutorial provides a step-by-step procedure for creating the service and writing events to an application-specific event log. The second tutorial shows how to modify the service to install and uninstall itself from the command line, which I find of great use.
Second, you need to decide how you are going to communicate between your MFC application and your Windows service. Any kind of inter-process communication (IPC) model will work - sockets, pipes, shared memory, WCF, etc. Since you are wanting to migrate to .NET anyway, I would recommend using Windows Communication Foundation (WCF), which is the way I've done it. Specifically, I chose the named pipe aspect of WCF for my communication method based on the chart shown here.
If you go down the WCF route, you'll benefit from the fact that the communication between application and service is .NET-based. Thus, when you move your application to .NET, the communication mechanism won't have to be rewritten. The trick in the meantime is getting your MFC application to use the WCF code. To do this, write the WCF client code in a .NET assembly using C#. Then, use a C++ dll to bridge the gap between your MFC code and the .NET assembly. I've got another tutorial with step-by-step instructions for how to do this.
Hope this helps.
I have been doing ASP.NET / C# development for several years now. I have recently been offered a project that will need to be a winforms application (I am assuming .net 2.0).
Specs:
Winforms applicaton
Application will
have "testing for understanding
questions"
Must support flash and camtasia
files (these are "lessons")
I have done winforms development before, although nothing that is this involved. As there is a potential need for this application to be generic enough to apply to multiple different "disciplines", I would like to make the application generic enough to be easily configurable. The caveat here is that the application will need to be run from a CD-ROM and that I cannot rely explicitly on an internet connection. I was thinking of using something like SQL-Lite to support the configuration of the application. There will not be the need for updating the application as it will not be updated (at least I don't think, I guess there is the possibility of the application calling a webservice and configuring its-self based upon returned values).
With the requirements of supporting Flash and Camtasia, along with making this application generic enough to support different "disciplines", and my self being an ASP.NET developer, does anyone have an recommendations or tips/ tricks to look out for? Has anyone done something like this before?
Thanks in advance.
I'd start by writing a user control that can be used to either display a video file (presumably the output from Camtasia) or a Shockwave app. Once you have that user control, I'd then move on to look at the overall app.
If you're using Winforms, and the software is supposed to run from the CD (instead of merely be installed from CD) you'll need to have the DotNet framework already on the computer I think - but then I'm not an expert in deployment.
I find the application model in Winforms to be a lot easier than WebForms, but then I was "raised" in thick clients, so I suppose I would.
I would also, whilst agreeing to WinForms if needs really must, encourage the client to give consideration to using WPF instead - which opens up the idea that you could also provide access over the web using a simlar interface using Silverlight...
Just a few thoughts anyway - good luck with it...
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).
I'm working on a project that needs to produce an application that runs both as a stand-alone application and a web application. We're considering using the User Interface Process (UIP) Application Block that available on the Microsoft Patterns & Practices web site.
The application block claims it can make this possible:
This block is a reusable code
component that builds on the
capabilities of the Microsoft .NET
Framework to help you create both Web
Forms- and Windows Forms-based
applications.
Before we commit too much time to further investigation I'm wondering if anyone has had experience with using the UIP Application Block to create a Web-Forms- and a Windows Forms-based applications. How successful were you in separating the business logic from the user interface logic when using UIP?
I'm currently working on a project with the UIP. I won't say it's bad because I haven't really invested more than a day on it. But let me express one feeling: It's Saturday, my friends are hanging out drinking beers. I'm at the office, struggling to use it and reading around 50 pages of documentation. The web.config for the app is huge due to the amount of nodes it is using. I'm really, really sad and even I love Microsoft and programming because thanks to them I have a job to pay the rent... I am really frustrated, right now. And I'm usually a very happy guy.
I would rather use Aspnet MVC, cleaner, newer and built with the community input.
Hope this helps.
I used the UIP to create an application to report insurance claims a few years ago. I found that it added complexity without any real benefit.
The UIP is not intended to keep your business logic and UI seperate. It's goal is to allow you to re-use your UI logic for both asp.net and winforms. This doesn't work out very well in practice because desktop apps and web apps are two completely different animals.
I also experienced quite a few bugs related to session state on the asp.net side (I can't remember the details, sorry). I eventually got sick of it stripped out all the UIP related code from the web app. After I did this it made the code much easier to understand and debug.
If your looking for a way to keep your UI separate from your business logic then you should check out CSLA.net.
The UIP really sucked, I had a horrible experience using it. If you want a good example of the kind of architecture you are after download the Northwind Starter Kit.
It shows using different back ends/DB access techniques (SQL Server/Access/NHibernate) and different front ends (ASP.NET MVC/Monorail/Windows Forms/WPF).
It also has an associated book- "Architecting Applications for the Enterprise"