Click here to Skip to main content
15,868,141 members
Articles / Web Development / ASP.NET

Control your Distributed Application using Windows and Web Service

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
15 Aug 2010CPOL4 min read 22.9K   606   19   2
Control your distributed application using Windows and web service
whole_20system_.gif

Introduction

I am working on a project which connects clients' PCs with Server by using Windows and web service.

Background

The idea came when I had to make an order from a restaurant call center, by using XML files and avoid network problems and support parallel requests.

Technologies Used

  • (Windows service, web service) as core operation
  • Windows application as (user interface, monitoring and notifications)
  • System tasted & worked fine using:
    • Microsoft:
    • WindowsXP
    • XMLnWebService
    • C# for all sections
    • Microsoft CLR1.1
    • Visual studio.NET 2003

System Structure

"Sending"

The code begins when Action is done & a file released on Server1.[Send folder], then server1 tries to send it to the required server via web service, in case of failed sending, then send data to "Retry" system which works in parallel with the basic system.

"Retry System"

reTry_20System.jpg

  • * retry system, retry sending the data for n times, then send the data (if failed to send by retry system) to faxing system,
  • * fax system try to send data
    If failed retry faxing (n) times then dump data to failed folder and create report
    ---------
  • If success to send, then web service on the client computer dumps the data on a client.[received folder] or server2.[received folder]
  • When this is done, a fie watcher on the client computer takes the file received on the [received folder] and does whatever action
    --------
    ... then reverse way starts
  • Server2 or client computer sends a file to [send folder]
  • Windows service file Watcher catches it and tries to call web service placed on server1 exactly like what was done on the server1.
  • When server1's Windows service feels received files sent by server2 via web Service and does whatever action is based on received data.

Monitor and Notification Systems

The system is divided to 2 parts:

  1. Core system (Windows service and Web service)
  2. Interface system (Windows applications "Monitor"," Notification")
1. Monitor

It is the name in the attached project "windows Service and Windows Interface".

This application is used to control windows service (stop/run), and monitor client connectivity (by trying to call a function on the web service over target PC "Is Connected" that returns true).

And configuration interface that defines:

  • retry system values
  • paths for sending and receiving folders
  • registered servers (names and IPs)

And any others values like retry due, interval, faxing retry,... etc.

2. Notification

NotifyPopup.jpg

This system is inside the monitor system, but it's abstractly a system that has a file watcher on a folder (notification).

When windows service wants to alert for an event to the user, it places a file that has alerting information in the notification folder.

Then file watcher catches it & notifies the user.

It's also customizable to put any images / delay / etc. all by INI file attached.

I'd like to thank John O'Byrne for his article: Taskbar Notify.

It helped me a lot on this section, but I added some additional options like dynamic skinning.

I also attached SQL server database to control Notifies With remembers Missed notifications and alarms, so you can restore them later.

Using the Code

"If you want to change the place of the Config files c:\Server1\settings, you can do it from structures class (config structure) on both Monitor and Windows service applications".

A brief description of how to use code is given below:

C#
//1) in the  winServiceAndWindowsInterface application I overloaded Notify for 
easy use But it takes structure contains all properties that event can have for example :
//Creating structure object to fill with event's info
StructDisplayInfo inInfo = new StructDisplayInfo();
 inInfo.initilize();
//Set some of it's properties 
 inInfo.popupTitle = title; inInfo.popupPrifeInfo = prifeInfo; 
//select type (notify/alert/Error)
inInfo.TypeInt =(int) StructDisplayInfo.Typeenum.Notify;
//Real Display it 
 NotifyMe myNotify = new NotifyMe(inInfo);
==================================
(other example)
 
this one I think have Full properties 
StructDisplayInfo inInfo = new StructDisplayInfo();
 inInfo.initilize();
 inInfo.TypeInt = (int)type;
 //popup Settings inInfo.popupTitle = title;
 inInfo.popupPrifeInfo = prifeInfo; 
//form settings inInfo.frmText = title;
 inInfo.Maintitle = formMainText;
 inInfo.lblDetails = lblDetails;
 inInfo.details = Details;
 inInfo.DateTimeOfEvent = EventDateTime;
 inInfo.ServerIP = ServerIP;
 inInfo.ServerName = ServerName;
 inInfo.Info1 = info1;
 inInfo.lblInfo1_title = lblInfo1;
 inInfo.Info2 = info2; inInfo.lblInfo2_title = lblInfo2; 
inInfo.fileName= fileName;
 inInfo.Footer = footer;
 //system Settings inInfo.ShowForm = true;
 inInfo.AddtoDatabase = AddtoDatabase; 
//realize popup NotifyMe myNotify = new NotifyMe(inInfo);

SET UP Project Steps

To setup this project, you have to:

  1. Place the folder Server1 on the c:\ (You can configure later).
  2. From c:\Server1\Settings\, you can configure all paths and settings related to the system, from 2 INF files:
    1. "MonitorConfigrations.ini" for Monitor system and notification, and Monitor Database Connection string (database attached on: Server1\Database\myDatabase_Data.MDF)
    2. "inf.ini" for Servers, retry and other core settings
  3. Setup the database in your SQL server (it's for remembering missed Events) one table, so you can join it with your already made database and setup its connection string on "MonitorConfigrations.ini"
  4. Setup the Windows service: "Server1WindowsSevice.exe"
    Using the Installutil.exe supported with .NET Tools.
  5. Setup XML Web service on your IIS or on another Machine (and remember to send it to the inf.ini).

Example

[RegisteredServers] 
IP1=http://10.0.0.3/Server1WebService/Service1.asmx 
IP2=...... (have to be the full address of the target web service) 
[RegisteredServersNames] 
Server1=Server1 
Server2=myPC(just a Nike name ) 

Then run the Windows service... it should work fine.
Then about the User interface, it's on this file: "winServiceAndWindowsInterface.exe".
You can run it easily. It will appear in the task bar & will control and monitor the job.

Points of Interest

The project is full dynamic using Multi threads specially when it check status of all servers every interval, check them all at once (not sequential). Also dial with servers and Windows/Web service and control them and retry when connection failed, etc.

Future Work

I am looking for:

  • Enhancing user Interface Windows application
  • Include user Interface for client PC too
  • Enhance event notification system
  • Sure your comments for any upgrade ideas :)

History

  • 15th August, 2010: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader ArabicRobotics.com
Egypt Egypt
Tareq Gamal El-din Mohammed,
---------
Website:
www.ArabicRobotics.com

---------

Graduated from Modern Academy for Computer science and Information Technology. Egypt,
Then flow Microsoft development track Certificates:
MCAD.NET (Microsoft Certified Application Developer)
MCSD.NET (Microsoft Certified Solution Developer)
Microsoft SharePoint Administration, Configuration and Development.

Robotics fields was a Hobby since 2002,
started to develop some applications for "Robosapien", "RoboSapienV2", "RS Media", RoboMe and WowWee Rovio. from WowWee company,

Started working with robots as a professional way at 2014
By using "NAOqi" Robotics from Aldebaran.

By developing some applications and libraries like :
NAO.NET.
https://www.youtube.com/watch?v=oOyy-2XyT-c

OpenCV with NAO Robot:

- NAORobot Vision using OpenCV -TotaRobot P1
https://www.youtube.com/watch?v=MUcj8463x08

- NAO Robot Vision using OpenCV - P2
https://www.youtube.com/watch?v=93k1usaS-QM

NAO Alarm Clock :
https://www.youtube.com/watch?v=djLlMeGLqOU
-----------------------------

also Robotic Arm Project:


Other Projects Developed by Tareq Gamal El-din Mohammed :

Developed and posted some applications in Code Project web site like :

- Control your Distributed Application using Windows and Web Service
http://www.codeproject.com/Articles/101895/Control-your-Distributed-Application-using-Windows


- Quick and dirty directory copy
http://www.codeproject.com/Articles/12745/Quick-and-dirty-directory-copy

- Program Execute Timer(From the Web)
http://www.codeproject.com/Articles/12743/Program-Executer-Timer

Comments and Discussions

 
Questionany updates to vs 2008 ? Pin
kiquenet.com17-Aug-10 4:42
professionalkiquenet.com17-Aug-10 4:42 
AnswerRe: any updates to vs 2008 ? Pin
Tareq_Gamal1-Sep-10 10:08
Tareq_Gamal1-Sep-10 10:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.