473,471 Members | 4,637 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Web Interface for a c# Console Application

Hi,

I have written a Console Application that is doing different things,
like checking the status of different network Hosts.

I would like to implement a WebInterface to show such status, and maybe
also send some commands to my app.

It is possible to do it in asp.net ? I though I only need to "pass" my
object reference to the ASP page, so I can access its proprieties...
But I don't know how to do it (and if it is possible).

I saw lots of threads about WinForms to WebForms, but none about
ConsoleApp to Web.

Any link would be very appreciated.
Thanks

Viashino

Jan 2 '07 #1
10 10075
Hi there

By the sounds of things, all your logic is in the console app.

What you could do is put all of this in a class library and the use the
console or asp.net as the ui layer

Sam

Jan 2 '07 #2
Thank you for the answer.

Indeed the logic is in the console app, since this program needs to run
24/24.

I don't know if putting it in a class library would work, since I need
to access the objects, and not the classes.
I think that putting it in a class library means only exporting the
classes... Am I wrong? (class library is pretty new to me).

Can you please add some link?

Thanks

samuelhon ha scritto:
Hi there

By the sounds of things, all your logic is in the console app.

What you could do is put all of this in a class library and the use the
console or asp.net as the ui layer

Sam
Jan 2 '07 #3
Hi

If this is the case then a console app is the wrong kind of app, you need
either a win service or a web service, the later is my suggested way to go.

Or simply you could implement a web app around it

--
Ignacio Machin
machin AT laceupsolutions com

<vi******@email.itwrote in message
news:11*********************@k21g2000cwa.googlegro ups.com...
Hi,

I have written a Console Application that is doing different things,
like checking the status of different network Hosts.

I would like to implement a WebInterface to show such status, and maybe
also send some commands to my app.

It is possible to do it in asp.net ? I though I only need to "pass" my
object reference to the ASP page, so I can access its proprieties...
But I don't know how to do it (and if it is possible).

I saw lots of threads about WinForms to WebForms, but none about
ConsoleApp to Web.

Any link would be very appreciated.
Thanks

Viashino

Jan 2 '07 #4
Well, I couldn't use win service, because it would run also on Linux.

About web service, I found something (gooogling a lot), and was
thinking about it.

But I have a problem with both web services and remoting (that was
another option I found).

When I try to compile I get that it can't find the namespace "Services"
inside System.Web.
I downloaded different pieces of codes and always get the same error.
Also I "don't have" Channel.Tcp (for remoting)...

Do I need additional packages?
I have .Net v2.0.50727

Thank You for your answer.

Ignacio Machin ( .NET/ C# MVP ) ha scritto:
Hi

If this is the case then a console app is the wrong kind of app, you need
either a win service or a web service, the later is my suggested way to go.

Or simply you could implement a web app around it

--
Ignacio Machin
machin AT laceupsolutions com

<vi******@email.itwrote in message
news:11*********************@k21g2000cwa.googlegro ups.com...
Hi,

I have written a Console Application that is doing different things,
like checking the status of different network Hosts.

I would like to implement a WebInterface to show such status, and maybe
also send some commands to my app.

It is possible to do it in asp.net ? I though I only need to "pass" my
object reference to the ASP page, so I can access its proprieties...
But I don't know how to do it (and if it is possible).

I saw lots of threads about WinForms to WebForms, but none about
ConsoleApp to Web.

Any link would be very appreciated.
Thanks

Viashino
Jan 2 '07 #5
Hi,

vi******@email.it wrote:
Thank you for the answer.

Indeed the logic is in the console app, since this program needs to run
24/24.
If an application must run 24/7, the best would probably be a windows
service, but I leave that to you. Actually, any kind of application may
run 24/7 (if programmed with care, and accepting a perfect stability),
so this specific requirement does not necessary lead to a console
application.

Additionally, even if the application itself is a console one, it can
still use a class library. A clever design would put all reusable code
in a class library (a DLL), and keep the UI (or in your case the console
app) as thin as possible. This way the cost of migrating an application
from Windows to the web is very small.
I don't know if putting it in a class library would work, since I need
to access the objects, and not the classes.
Classes and objects is (almost) a synonym. "Class library" is just a
name, don't read too much into it.

To create a class library, simply choose the according project type in
Visual Studio. Then you can move all the classes you want into that
project. Then add a reference to that project (or to the produced DLL,
but that's not recommended) into your console application. From this
moment on, you can use the classes as if they were in the same project.
I think that putting it in a class library means only exporting the
classes... Am I wrong? (class library is pretty new to me).

Can you please add some link?

Thanks
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 2 '07 #6
Not sure why you are having these issues.
I have written a web app that allows control of remote devices via remoting
to a windows service.
The win service knows how to communicate with the devices.
The Web App provides a web based 'live' interface to said devices.
The Web App communicates with the win service via remoting.

Gerry
<vi******@email.itwrote in message
news:11**********************@n51g2000cwc.googlegr oups.com...
Well, I couldn't use win service, because it would run also on Linux.

About web service, I found something (gooogling a lot), and was
thinking about it.

But I have a problem with both web services and remoting (that was
another option I found).

When I try to compile I get that it can't find the namespace "Services"
inside System.Web.
I downloaded different pieces of codes and always get the same error.
Also I "don't have" Channel.Tcp (for remoting)...

Do I need additional packages?
I have .Net v2.0.50727

Thank You for your answer.

Ignacio Machin ( .NET/ C# MVP ) ha scritto:
>Hi

If this is the case then a console app is the wrong kind of app, you need
either a win service or a web service, the later is my suggested way to
go.

Or simply you could implement a web app around it

--
Ignacio Machin
machin AT laceupsolutions com

<vi******@email.itwrote in message
news:11*********************@k21g2000cwa.googlegr oups.com...
Hi,

I have written a Console Application that is doing different things,
like checking the status of different network Hosts.

I would like to implement a WebInterface to show such status, and maybe
also send some commands to my app.

It is possible to do it in asp.net ? I though I only need to "pass" my
object reference to the ASP page, so I can access its proprieties...
But I don't know how to do it (and if it is possible).

I saw lots of threads about WinForms to WebForms, but none about
ConsoleApp to Web.

Any link would be very appreciated.
Thanks

Viashino

Jan 2 '07 #7
unless you are talking static on a single machine there is a huge difference
between a class and an object.
2 processes making use of a single physical object is entirely different
than 2 processes making use of 2 seperate objects of the same type.

Gerry
"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:O$**************@TK2MSFTNGP03.phx.gbl...
Hi,

vi******@email.it wrote:
>Thank you for the answer.

Indeed the logic is in the console app, since this program needs to run
24/24.

If an application must run 24/7, the best would probably be a windows
service, but I leave that to you. Actually, any kind of application may
run 24/7 (if programmed with care, and accepting a perfect stability), so
this specific requirement does not necessary lead to a console
application.

Additionally, even if the application itself is a console one, it can
still use a class library. A clever design would put all reusable code in
a class library (a DLL), and keep the UI (or in your case the console app)
as thin as possible. This way the cost of migrating an application from
Windows to the web is very small.
>I don't know if putting it in a class library would work, since I need
to access the objects, and not the classes.

Classes and objects is (almost) a synonym. "Class library" is just a name,
don't read too much into it.

To create a class library, simply choose the according project type in
Visual Studio. Then you can move all the classes you want into that
project. Then add a reference to that project (or to the produced DLL, but
that's not recommended) into your console application. From this moment
on, you can use the classes as if they were in the same project.
>I think that putting it in a class library means only exporting the
classes... Am I wrong? (class library is pretty new to me).

Can you please add some link?

Thanks

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Jan 2 '07 #8
Hi Gerry,

gerry wrote:
unless you are talking static on a single machine there is a huge difference
between a class and an object.
2 processes making use of a single physical object is entirely different
than 2 processes making use of 2 seperate objects of the same type.

Gerry
You are absolutely right. The apparent confusion in the OP's post got to
me too.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 2 '07 #9
Hi,

Well, I downloaded Visual Studio Web Developer, and now I can run
WebServices (didn't tried remoting). Now I'm going to implement the
WebService into my code to export some methods of my objects. It should
work... I suceed in a "hello world" WebService so its just a question
of time :D

Thanks for answering.
Viashino

gerry ha scritto:
Not sure why you are having these issues.
I have written a web app that allows control of remote devices via remoting
to a windows service.
The win service knows how to communicate with the devices.
The Web App provides a web based 'live' interface to said devices.
The Web App communicates with the win service via remoting.

Gerry
<vi******@email.itwrote in message
news:11**********************@n51g2000cwc.googlegr oups.com...
Well, I couldn't use win service, because it would run also on Linux.

About web service, I found something (gooogling a lot), and was
thinking about it.

But I have a problem with both web services and remoting (that was
another option I found).

When I try to compile I get that it can't find the namespace "Services"
inside System.Web.
I downloaded different pieces of codes and always get the same error.
Also I "don't have" Channel.Tcp (for remoting)...

Do I need additional packages?
I have .Net v2.0.50727

Thank You for your answer.

Ignacio Machin ( .NET/ C# MVP ) ha scritto:
Hi

If this is the case then a console app is the wrong kind of app, you need
either a win service or a web service, the later is my suggested way to
go.

Or simply you could implement a web app around it

--
Ignacio Machin
machin AT laceupsolutions com

<vi******@email.itwrote in message
news:11*********************@k21g2000cwa.googlegro ups.com...
Hi,

I have written a Console Application that is doing different things,
like checking the status of different network Hosts.

I would like to implement a WebInterface to show such status, and maybe
also send some commands to my app.

It is possible to do it in asp.net ? I though I only need to "pass" my
object reference to the ASP page, so I can access its proprieties...
But I don't know how to do it (and if it is possible).

I saw lots of threads about WinForms to WebForms, but none about
ConsoleApp to Web.

Any link would be very appreciated.
Thanks

Viashino
Jan 2 '07 #10
Indeed the logic is in the console app, since this program needs to run
24/24.If an application must run 24/7, the best would probably be a windows
service, but I leave that to you. Actually, any kind of application may
run 24/7 (if programmed with care, and accepting a perfect stability),
so this specific requirement does not necessary lead to a console
application.

Additionally, even if the application itself is a console one, it can
still use a class library. A clever design would put all reusable code
in a class library (a DLL), and keep the UI (or in your case the console
app) as thin as possible. This way the cost of migrating an application
from Windows to the web is very small.
This is the way to go. Put all core logic in the class library and then
use different UIs (console, web or windows) to control/view responses.

I would suggest working on this first (using the console to test)
before worrying about web or windows services

Sam

Jan 3 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: arjohn7481 | last post by:
Hello everyone, Can someone help me in deciding the development language? I need to develop a "regular console application" which will require - 1. Communication with another application over...
7
by: Job Lot | last post by:
How can I terminate console application in Try…Catch…Finally…End Try block so that code in Finally gets executed. If I use End statement Finally does not get executed. Following is my code...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
3
by: inpreet | last post by:
I am trying to build a console application in C#.Net. This application is suppose to run in background without user interaction. How can I hide console to appear?
8
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
9
by: John Williams | last post by:
How do I load a HTML page (via URL) and parse the DOM in a Console Application? I've successfully done all this in a Windows Application by using the WebBrowser control, calling the Navigate...
0
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is...
6
by: Krish | last post by:
I want to develop and application that run periodically in the server machine. Now Should I go for a windows service or just create a Console application and schedule it using the windows Task...
0
by: Stephen Thomas | last post by:
Hi there I wonder if any one has encountered this problem or can suggest what is wrong. I am trying the a procedure from the msn site but get the following message: Error 1 The type or...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.