473,385 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to start ASP.Net application from console application?

Hi,
I have the following problem:
I have a singleton class that I want to access from asp.net
application. The trick is, that I want to create it
(Singleton.GetInstance() for the first time) in console application.
In other words, I want the following to happen:
1. start console application
2. create object
3. start asp.net and pass the object reference
4. after some time, user surfs to asp.net page, and sees some
properties assosiated to that
object.

Can I accomplish that without using 2 processes (console and asp.net)
and .Net remoting between them?

Thanx alot,
Mike

Nov 27 '05 #1
9 2730
Why would you want to do this?

As a side note, you might want to consider
creating a .NET webservice and have your
console app pass the object in as a parameter.

Your web service for that application can
decide what to do with it in the context of
ASP.NET.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"Mike" <po****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,
I have the following problem:
I have a singleton class that I want to access from asp.net
application. The trick is, that I want to create it
(Singleton.GetInstance() for the first time) in console application.
In other words, I want the following to happen:
1. start console application
2. create object
3. start asp.net and pass the object reference
4. after some time, user surfs to asp.net page, and sees some
properties assosiated to that
object.

Can I accomplish that without using 2 processes (console and asp.net)
and .Net remoting between them?

Thanx alot,
Mike

Nov 27 '05 #2
Let me explain why I want this.
I want my singleton to be independent of the asp.net webserver.
The webserver might run, or stop running, but it shouldn't interfere
with the singleton.
In the same time I want the webserver to know my singleton as a local
object.

I didn't understand your webservice suggestion. Webservice
communication is done by exchanging xml messages, and thats not what I
want. I want my asp.net webserver
to have a local reference to singleton object.

Thanx alot,
Mike

Nov 27 '05 #3
Hmmm. What exactly does the singleton object do
and what does it hold? Perhaps there is an
alternate solution to a singleton that completes
the task you are after.

Your app can be recycled and still maintain state
by using StateServer. You could also run this
across a web farm using a product like
ScaleOut Software's StateServer:

http://www.eggheadcafe.com/articles/scaleout_server.asp

I don't think you can reliably do what you are wanting
to do. Plus, your app wouldn't scale to a server farm.
You don't generally want to design yourself into
a corner like that.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"Mike" <po****@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
Let me explain why I want this.
I want my singleton to be independent of the asp.net webserver.
The webserver might run, or stop running, but it shouldn't interfere
with the singleton.
In the same time I want the webserver to know my singleton as a local
object.

I didn't understand your webservice suggestion. Webservice
communication is done by exchanging xml messages, and thats not what I
want. I want my asp.net webserver
to have a local reference to singleton object.

Thanx alot,
Mike

Nov 27 '05 #4
Are you talking about controlling the ASP.NET application?

You can host the ASP.NET application as part of your Console application and
then communicate with it if you need to via AppDomain Remoting...

ASP.NET Runtime Hosting:
http://www.west-wind.com/presentatio...netruntime.asp
Otherwise, if your app is not in control of hte ASP.NET hosting process (ie.
IIS or the ASP.NET Local server) there's no way other than some sort of
remote connectivity between processes (using Remoting or Web Services or
File Sharing or whatever).

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

"Mike" <po****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,
I have the following problem:
I have a singleton class that I want to access from asp.net
application. The trick is, that I want to create it
(Singleton.GetInstance() for the first time) in console application.
In other words, I want the following to happen:
1. start console application
2. create object
3. start asp.net and pass the object reference
4. after some time, user surfs to asp.net page, and sees some
properties assosiated to that
object.

Can I accomplish that without using 2 processes (console and asp.net)
and .Net remoting between them?

Thanx alot,
Mike

Nov 28 '05 #5
Hi,
thanx Rick for the informative article you provided.
The only question that is still hangs unanswered for me, is whether
there is a real difference between remoting between two appdomains, and
remoting between two processess.

The only difference I can see between the two scenarios, is that in the
scenario of two appdomains, console app will be able to shutdown
asp.net, before exiting.
In the " two processess", asp.net webserver is going to run absolutely
independently of the console application.

Am I missing something?

Thanx a lot,
Mike

Nov 28 '05 #6
My singleton is some network service, that accamulates information that
flows from the network. The asp.net webserver accessess the singleton,
in order to reflect that
accamulated info for clients, that browse to a certain page in the
server.

Hope I made myself clear enough.

Thanx,

Mike

Nov 28 '05 #7
Why aren't you using a database store for this information?

What happens when the console app dies? How
are you persisting that data?

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://robbemorris.blogspot.com

"Mike" <po****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
My singleton is some network service, that accamulates information that
flows from the network. The asp.net webserver accessess the singleton,
in order to reflect that
accamulated info for clients, that browse to a certain page in the
server.

Hope I made myself clear enough.

Thanx,

Mike

Nov 29 '05 #8
I am not interested in persisting, because this is "real-time" info,
that is not intrested to my clients
even 1/2 afterwards.
If console app dies, clients won't be able to connect and see the info
- and thats OK. Thats what I want.

Mike

Nov 29 '05 #9
You could write a windows service that opens up
and listens on a tcp socket. Then, you could
either simply connect to the tcp socket
on page load "or" using a client side ActiveX
control that can connect up to the tcp socket.

Perhaps Macromedia Flash...

You could also look into message queues.
The console app writes a message to the queue
and the asp.net application could read from
that whenever needed.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://robbemorris.blogspot.com

"Mike" <po****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I am not interested in persisting, because this is "real-time" info,
that is not intrested to my clients
even 1/2 afterwards.
If console app dies, clients won't be able to connect and see the info
- and thats OK. Thats what I want.

Mike

Nov 30 '05 #10

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

Similar topics

2
by: Krish | last post by:
This is my first attempt, please bear. I referenced Excel 10.0 Object from VS .NET IDE, I think this creates Interop Object for Excel. I have the following code. ------code start---- ...
5
by: The Last Danish Pastry | last post by:
Why might IIS 5.1 take a long time (8 seconds) to start a C# console application as a CGI process, but run a Delphi console app that does the same thing in no time at all? Apache2 starts and...
1
by: chad | last post by:
Hi, I am using Process.Start() to call a console application from ASP.NET page. When the code is executed, the Console application is opened. When it is done, it should have been terminated but...
6
by: Alexander Widera | last post by:
hello, if i start a program (an exe-file) with Process.Start(...) I don't have the required permissions that the programm needs (i could start the programm but the program needs special rights)....
2
by: Mark Huebner | last post by:
I am trying to create a web application with Visual Studio 2005 and C# that will start up a "keep alive" application on my web site's server. My DotNetNuke home page loads slowly when the site...
1
by: ESmith | last post by:
I want to create a small console application that essentially gets some information and then launches a Windows Application. What I want to do is have the console application launched in hidden...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
4
by: =?Utf-8?B?Tm9yZW1hYw==?= | last post by:
Here is what I am trying to get to: I have a console exe that grabs information from the network and writes to an XML file on the website that web pages then render information from. The console...
2
by: TampaWebDevelopment | last post by:
I have a Windows service that I have created. That service spins through the processes, looking to see if a certain application is running. If it is not, it starts it. The problem that I am having...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.