locked
Can ASP.NET work with a current process RRS feed

  • Question

  • User-1148506230 posted

    Hello,

    I am planning on writting a windows app (with no GUI) that will run on a server in the background. Is there any way I can get the running application and work with its public methods?


    Drew


    Monday, April 12, 2010 8:54 PM

Answers

  • User-952121411 posted

    Well your idea is right, but the implementation is not so much.  Lets refer to one common way to solve this since in regards to ASP.NET, since this forum surrounds that type of development.  In ASP.NET you can use as Application variable to store data in memory on the server that is probably static and unchanging.  All clients will have access to the Application value and prevents re-querying the data over and over to get the same thing every time.  Take a look at the following for some more information:

    Application State:

    http://msdn.microsoft.com/en-us/library/bf9xhdz4(vs.71).aspx

    Now the idea behind services is a good one for centralizing operations between applications, but the problem is that .asmx web services and WCF Services do not inherently have state, so trying to persist data in a service medium is going to be difficult.  There are some workarounds to incorporate state, but I do not think this would be the ideal solution either.

    Honestly, you may want to reassess the initial issue anyways.  Are you having any actual performance issues with SQL Server?  Between SQL server connection pooling, SQL server performance in general, and the tight bond between ASP.NET and SQL Server, there may not be a significant enough issue to address in the 1st place.  You might want to place some performance metrics around the current process and determine if it is anything worth addressing in the 1st place.

    Hope this helps! Smile

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 19, 2010 2:58 PM
  • User-36838843 posted

    Bascially I need to cache the main object of my desktop application into memory so a web client
    can say "Get me this..", or "Get me that".. All while not having to reconstruct the application each time they ask for something.

    I think you should have to create a web page (instead of desktop application) that generate cache object for you and schedule a task to call that web page(just like you are thinking to schedule your desktop application to run in back ground).   Here is the article that will help you to schedule task to call a web page.

    http://weblogs.asp.net/steveschofield/archive/2006/09/28/Schedule-a-task-to-call-a-webpage-using-Task-scheduler_2E00_.aspx


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 19, 2010 4:55 PM

All replies

  • User849259894 posted

    If you meant you want ASP.NET to run your applications method then it is not going to be easy as well and I wouldn't recommend it.  You will run into all kind of security, access problems and will be harder to debug.

    May be you should explain your scenario and there might be an alternative/better way than the above?

    Monday, April 12, 2010 9:48 PM
  • User-1148506230 posted

    Thanks for the reply... After some reading i think you might be right.

    Here is what I would like to do...

    I have a desktop application that pulls in many data datasources from all different places and
    I would some how like to store this in the servers memory so all the datasources
    do not have to be read from disk each time a user wants to request a specific portion.

    Bascially I need to cache the main object of my desktop application into memory so a web client
    can say "Get me this..", or "Get me that".. All while not having to reconstruct the application each time they ask for something.
    It would take too long to if I used a web services that reconstucted the app each request.


    I dont know if any of that makes sense or not.. but if it does i hope someone can provide some inside.

    Maybe what I need is a service that sits in memory that I can hit.. can WCF do that?

    Drew

    Tuesday, April 13, 2010 8:22 PM
  • User-952121411 posted

    Well your idea is right, but the implementation is not so much.  Lets refer to one common way to solve this since in regards to ASP.NET, since this forum surrounds that type of development.  In ASP.NET you can use as Application variable to store data in memory on the server that is probably static and unchanging.  All clients will have access to the Application value and prevents re-querying the data over and over to get the same thing every time.  Take a look at the following for some more information:

    Application State:

    http://msdn.microsoft.com/en-us/library/bf9xhdz4(vs.71).aspx

    Now the idea behind services is a good one for centralizing operations between applications, but the problem is that .asmx web services and WCF Services do not inherently have state, so trying to persist data in a service medium is going to be difficult.  There are some workarounds to incorporate state, but I do not think this would be the ideal solution either.

    Honestly, you may want to reassess the initial issue anyways.  Are you having any actual performance issues with SQL Server?  Between SQL server connection pooling, SQL server performance in general, and the tight bond between ASP.NET and SQL Server, there may not be a significant enough issue to address in the 1st place.  You might want to place some performance metrics around the current process and determine if it is anything worth addressing in the 1st place.

    Hope this helps! Smile

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 19, 2010 2:58 PM
  • User-36838843 posted

    Bascially I need to cache the main object of my desktop application into memory so a web client
    can say "Get me this..", or "Get me that".. All while not having to reconstruct the application each time they ask for something.

    I think you should have to create a web page (instead of desktop application) that generate cache object for you and schedule a task to call that web page(just like you are thinking to schedule your desktop application to run in back ground).   Here is the article that will help you to schedule task to call a web page.

    http://weblogs.asp.net/steveschofield/archive/2006/09/28/Schedule-a-task-to-call-a-webpage-using-Task-scheduler_2E00_.aspx


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 19, 2010 4:55 PM