CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2005
    Posts
    1,828

    .NET web service

    Can someone tell me the difference while creating .NET Service using Simple API and REST? Is it also possible to create one using WCF?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: .NET web service

    What is Simple API? Do you have a link?

  3. #3
    Join Date
    Apr 2005
    Posts
    1,828

    Re: .NET web service

    Quote Originally Posted by Arjay View Post
    What is Simple API? Do you have a link?
    By simple I mean the basic web service that every .NET developer is taught duing his training session, when it is compared with WCF and REST web service. Which one should be preferable?

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: .NET web service

    Quote Originally Posted by maverick786us View Post
    By simple I mean the basic web service that every .NET developer is taught duing his training session, when it is compared with WCF and REST web service. Which one should be preferable?
    I missed that training session. Are you referring to asmx?

    If so, for new coding there really isn't any reason to code with asmx any longer. It's an older, less flexible approach. WCF is a newer approach that supports multiple bindings (TCP, HTTP, HTTPS, REST, etc.). REST is a newer protocol (search for REST vs. SOAP).

    With Microsoft, WCF and REST have the advantage of being able to be hosted from different applications such as IIS, WAS (Windows Activation Service), a Windows Service, a console app, and so on.

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: .NET web service

    Quote Originally Posted by maverick786us View Post
    Can someone tell me the difference while creating .NET Service using Simple API and REST? Is it also possible to create one using WCF?
    You are going to end up creating a WCF service in any case. The question should be : Should my service expose REST, to be used with XML, or, should my service rather expose JSON.

    Both are platform independant, but if you are looking for speed, and what I'd recommend JSON, especially if your service is supposed to be used from a web platform.

  6. #6
    Join Date
    Apr 2005
    Posts
    1,828

    Re: .NET web service

    Quote Originally Posted by Arjay View Post
    I missed that training session. Are you referring to asmx?

    If so, for new coding there really isn't any reason to code with asmx any longer. It's an older, less flexible approach. WCF is a newer approach that supports multiple bindings (TCP, HTTP, HTTPS, REST, etc.). REST is a newer protocol (search for REST vs. SOAP).

    With Microsoft, WCF and REST have the advantage of being able to be hosted from different applications such as IIS, WAS (Windows Activation Service), a Windows Service, a console app, and so on.
    Thank you. Can you tell me the procedure to create a console App using WCF? Like, when I created a new project in Visual Studio 2012, I simply selected WCF Service Library, out of the 4 options, where ithe option of Web Service Console?

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: .NET web service

    Quote Originally Posted by maverick786us View Post
    Thank you. Can you tell me the procedure to create a console App using WCF? Like, when I created a new project in Visual Studio 2012, I simply selected WCF Service Library, out of the 4 options, where ithe option of Web Service Console?
    What hosts the WCF service is something called the ServiceHost class. To do this inside your existing WCF Service library solution, you simply add a new project (i.e console project) to your solution. You set the console app as the startup app, and add a (solution) reference to the WCF service library project. Inside the console app's main, you use the ServiceHost class to host the WCF service. Search bing or google for "How to host a WCF service inside a console app".

    All that being said, using a console app isn't the way to go for many reasons unless you are simply testing the service out. If you plan to use this in production, then host WCF in IIS, WAS or a Windows Service.

    Hosting it in a Windows Service is pretty simply - especially if you use the hosting class that I've written (or your own version of the same). See the articles in my signature line - the one with a multi-part series. There is some code with a class called WcfServiceHost (I think).

    That class loads up any WCF services defined in the config file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured