Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Windows Service or Web Service?

Windows Service or Web Service?

Scheduled Pinned Locked Moved C#
databasesql-serversysadminwindows-adminquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cormac M Redmond
    wrote on last edited by
    #1

    Hi, I am developing a Windows app that needs to talk to a server, to retrieve some information. The server will run SQL Server, which I need to query, presumably through a stored procedure. How do you recommend I talk to the server, directly from the client application? It is slightly difficult, because its a client application, and not a web application that would have a backend on the server. All I need to do is say "Hello server, give me the number at x in table y." I'm presuming a 'web service', but is there possibly an easier way through IIS, somehow? Or maybe a Windows Service? Regards, Cormac Redmond

    C P 2 Replies Last reply
    0
    • C Cormac M Redmond

      Hi, I am developing a Windows app that needs to talk to a server, to retrieve some information. The server will run SQL Server, which I need to query, presumably through a stored procedure. How do you recommend I talk to the server, directly from the client application? It is slightly difficult, because its a client application, and not a web application that would have a backend on the server. All I need to do is say "Hello server, give me the number at x in table y." I'm presuming a 'web service', but is there possibly an easier way through IIS, somehow? Or maybe a Windows Service? Regards, Cormac Redmond

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Cormac M Redmond wrote:

      How do you recommend I talk to the server, directly from the client application?

      That depends where the client application is. If the client application is on the same LAN then you can have it connect directly to the SQL Server. If the client application is accessing the database via the web then a web service will be needed to act as an intermediate - filtering and validating requests and authenticating that they are being made from valid sources.


      Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

      C 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Cormac M Redmond wrote:

        How do you recommend I talk to the server, directly from the client application?

        That depends where the client application is. If the client application is on the same LAN then you can have it connect directly to the SQL Server. If the client application is accessing the database via the web then a web service will be needed to act as an intermediate - filtering and validating requests and authenticating that they are being made from valid sources.


        Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

        C Offline
        C Offline
        Cormac M Redmond
        wrote on last edited by
        #3

        Cormac, Sorry, yeah I should have been clearer. The client can be anywhere, so cannot connect to the SQL Server directly. Whether a Windows Service, or a Web Service, there'll be authentication. I am aiming for installation simplicity, etc, so maybe a Windows Service would be easier? It would mean the admin, or whoever, wouldn't need to setup an IIS/ASP.NET server. I've never had to write one, but I'm guessing it'd be relatively straight forward. Can you think of any advantages of a web service? Note: All the client needs is a string...Nothing more. It's an application aimed at non-tech type (fictional!) companies. Regards, Cormac

        C 1 Reply Last reply
        0
        • C Cormac M Redmond

          Cormac, Sorry, yeah I should have been clearer. The client can be anywhere, so cannot connect to the SQL Server directly. Whether a Windows Service, or a Web Service, there'll be authentication. I am aiming for installation simplicity, etc, so maybe a Windows Service would be easier? It would mean the admin, or whoever, wouldn't need to setup an IIS/ASP.NET server. I've never had to write one, but I'm guessing it'd be relatively straight forward. Can you think of any advantages of a web service? Note: All the client needs is a string...Nothing more. It's an application aimed at non-tech type (fictional!) companies. Regards, Cormac

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Cormac M Redmond wrote:

          The client can be anywhere, so cannot connect to the SQL Server directly. Whether a Windows Service, or a Web Service, there'll be authentication. I am aiming for installation simplicity, etc, so maybe a Windows Service would be easier?

          If the client can be anywhere that rules out a windows service. Also, "anywhere" implies firewalls and most admins won't want to add holes to their firewalls, but they will permit port 80 (http). That then narrows your choice to a web application. e.g. a web service.

          Cormac M Redmond wrote:

          Can you think of any advantages of a web service?

          Getting through a firewall because the ports for http and https are usually already open.

          Cormac M Redmond wrote:

          It's an application aimed at non-tech type (fictional!) companies.

          I don't understand what you mean by "fictional" (unless you mean that this is just a hypothetical situation). Non-technical companies will still have some form of IT department (unless it is a very small company) which should be able to configure IIS. Windows Server 2003 has some nice wizards to make this easier for part-time admins. Any which way you want to look at it, the server will have to have some configuration to allow the information to pass. It is normally better to put it in the sandbox of an ASP.NET application running in IIS because it has restricted privileges and so it shouldn't be able to do much damage if the process runs amok.


          Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

          C 1 Reply Last reply
          0
          • C Colin Angus Mackay

            Cormac M Redmond wrote:

            The client can be anywhere, so cannot connect to the SQL Server directly. Whether a Windows Service, or a Web Service, there'll be authentication. I am aiming for installation simplicity, etc, so maybe a Windows Service would be easier?

            If the client can be anywhere that rules out a windows service. Also, "anywhere" implies firewalls and most admins won't want to add holes to their firewalls, but they will permit port 80 (http). That then narrows your choice to a web application. e.g. a web service.

            Cormac M Redmond wrote:

            Can you think of any advantages of a web service?

            Getting through a firewall because the ports for http and https are usually already open.

            Cormac M Redmond wrote:

            It's an application aimed at non-tech type (fictional!) companies.

            I don't understand what you mean by "fictional" (unless you mean that this is just a hypothetical situation). Non-technical companies will still have some form of IT department (unless it is a very small company) which should be able to configure IIS. Windows Server 2003 has some nice wizards to make this easier for part-time admins. Any which way you want to look at it, the server will have to have some configuration to allow the information to pass. It is normally better to put it in the sandbox of an ASP.NET application running in IIS because it has restricted privileges and so it shouldn't be able to do much damage if the process runs amok.


            Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

            C Offline
            C Offline
            Cormac M Redmond
            wrote on last edited by
            #5

            By fictional I did mean hypothetical (just in case someone might comment on the fact that I might leave a company exposed). A Windows Service would self-install, and could listen on port 80, therefore eliminating the need for any configuration. That was my idea. I suppose I will go with a web service seeing as it's a bit safer, as you said.

            C 1 Reply Last reply
            0
            • C Cormac M Redmond

              By fictional I did mean hypothetical (just in case someone might comment on the fact that I might leave a company exposed). A Windows Service would self-install, and could listen on port 80, therefore eliminating the need for any configuration. That was my idea. I suppose I will go with a web service seeing as it's a bit safer, as you said.

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              Cormac M Redmond wrote:

              A Windows Service would self-install, and could listen on port 80, therefore eliminating the need for any configuration. That was my idea.

              Only if nothing else is. If IIS is already installed (or some other web software) who ever gets port 80 first wins - I've had software that took over port 80 before IIS got hold of it and it took hours to track down and fix. You don't want to irritate your customers like that, especially on a first impression.


              Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

              C 1 Reply Last reply
              0
              • C Colin Angus Mackay

                Cormac M Redmond wrote:

                A Windows Service would self-install, and could listen on port 80, therefore eliminating the need for any configuration. That was my idea.

                Only if nothing else is. If IIS is already installed (or some other web software) who ever gets port 80 first wins - I've had software that took over port 80 before IIS got hold of it and it took hours to track down and fix. You don't want to irritate your customers like that, especially on a first impression.


                Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                C Offline
                C Offline
                Cormac M Redmond
                wrote on last edited by
                #7

                Yeah, thanks a lot for the advice - very helpful.

                1 Reply Last reply
                0
                • C Cormac M Redmond

                  Hi, I am developing a Windows app that needs to talk to a server, to retrieve some information. The server will run SQL Server, which I need to query, presumably through a stored procedure. How do you recommend I talk to the server, directly from the client application? It is slightly difficult, because its a client application, and not a web application that would have a backend on the server. All I need to do is say "Hello server, give me the number at x in table y." I'm presuming a 'web service', but is there possibly an easier way through IIS, somehow? Or maybe a Windows Service? Regards, Cormac Redmond

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  If this is SQL Server 2005, it is possible to create something known as an HTTP Endpoint which basically allows SQL Server to create Web Services without having to have IIS installed on the server. There are a couple of little gotchas to be aware of with this on Win XP (but not Win 2003), but it does work and is kind of cool.

                  the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
                  Deja View - the feeling that you've seen this post before.

                  C 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    If this is SQL Server 2005, it is possible to create something known as an HTTP Endpoint which basically allows SQL Server to create Web Services without having to have IIS installed on the server. There are a couple of little gotchas to be aware of with this on Win XP (but not Win 2003), but it does work and is kind of cool.

                    the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
                    Deja View - the feeling that you've seen this post before.

                    C Offline
                    C Offline
                    Cormac M Redmond
                    wrote on last edited by
                    #9

                    Cool that sounds good. Probably wont be Server 2005, however. Unless Express 2005 allows for that...

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups