Can I expose my C#.net console application as a web service ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • inlovewithmusic
    New Member
    • Nov 2006
    • 14

    Can I expose my C#.net console application as a web service ?

    Hi ,

    I have written a C#.net console application, the application returns a list of processes running on a local machine. I would like to expose this funtionality as a web service. Can this be done ? If so can someone give me detailed steps on how to do it ?.

    I an pretty well versed in writing web services in ASP.net. I even tried compiling the .cs file of the console application and adding it as a reference to my web service to be able to create objects to access the string returned by the console application.
    But it does not seem to be working.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    I think that you will have to re-write it, decorating the methods you want available as WebMethod.

    Comment

    • TRScheel
      Recognized Expert Contributor
      • Apr 2007
      • 638

      #3
      You want to post a list of running process from which machine? The server or the client?

      Comment

      • inlovewithmusic
        New Member
        • Nov 2006
        • 14

        #4
        its for the client ....here's the scenario ..


        The client application (which i have currently written as a c#.net console application) runs continuously on a pc on a network. It returns a some statistics about the status of the environment such as the cpu usage .

        I want to expose it as a web service so that I can access it from a asp.net website hosted on a central server...

        Comment

        • TRScheel
          Recognized Expert Contributor
          • Apr 2007
          • 638

          #5
          Originally posted by inlovewithmusic
          its for the client ....here's the scenario ..


          The client application (which i have currently written as a c#.net console application) runs continuously on a pc on a network. It returns a some statistics about the status of the environment such as the cpu usage .

          I want to expose it as a web service so that I can access it from a asp.net website hosted on a central server...
          So you want to have the remote machine run a program continuously that would update a file with information about the system environment?

          A couple ways you can do this. You can have the program write to a publicly read allowed file that updates periodically. If using this method I would suggest XML. Then have your central server render a page after retrieving all the remote XML files.

          The other way to do this is to have that console application return a web page with the information itself when you go to that machines address.


          In my mind the first method would be much easier as you could go about doing the following:

          1) Turning your console application into a service OR creating a task to run your application every minute/few minutes/hours/etc which would update the publicly available xml file.
          2) Create a web application that would pull the xml file from a list of addresses you would supply
          3) The web application would then build/add to an internal table when called to present to you

          Comment

          Working...