none
Recognize WCF solution RRS feed

  • Question

  •  It tried that in StackOverflow, but it seems that nobody knows the answer for that. So I try it here.

    I am new in Web Service Developement in .NET. Now I am analyzing a big solution of dozens of projects. There I have project that uses a web service and I want to know if it is a WCF Service or some other kind like Web API...
    In the past I used ASMX Web Services in .NET and you were able to recognize a ASMX web service via its file extension. But here I don't see any special extensions in the project. I have read that WCF Services have .svc files if they are hosted in IIS. But this project doesn't have a .svc file. So, what are the main characteristics which distinguish a WCF Service from other web services in .NET. The structure of the solution is as following:

    -Solution +-CreateDocWebServiceInterface +-CreateDocWebService +-...

    The CreateDocWebServiceInterface looks like that:

    namespace CreateDocWebServiceInterface
    {
        /// <summary>
        /// </summary>
        [ServiceContract(Name = "ICreateDocWebService", Namespace = "http://www.standardlife.de/CreateDocWebService")]
        [RequiredParametersBehavior]
        [ServiceKnownType(typeof(Bookmark))]
        [ServiceKnownType(typeof(List<Bookmark>))]
        public interface ICreateDocWebService
        {
            [OperationContract]
            byte[] CreateDoc(OutputFormat OutputFormat, bool DuplexPrinting, List<Document> Documents);        
        }
    }

    And the CreateDocWebService looks like that:

    namespace CreateDocWebService
    {
        // single threaded, but each request is handled concurrent !
        [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single, Namespace = "http://www.blablabla.de/CreateDocWebService")]
        public class CreateDocWebService : ICreateDocWebService
        {
            public byte[] CreateDoc(OutputFormat outputFormat, bool duplexPrinting, List<Document> documents)
            {
                bla bla bla
            }
        }
    }

    It could be a Web Service with Web API, but as I know Web API web services consist of controllers which derive from the ApiController?!(Is this correct and the unique characteristic of Web Api Web Services?) So is this a WCF Service? And what is the unique characteristic of a WCF service and of an Web API Web Service

    Friday, December 22, 2017 8:04 AM

Answers

  • Hi MbProgstar,

    Has your issue been resolved?

    As the suggestion from DA924x, your service is WCF Service.

    To check whether it is WCF Service, you could follow below points.

    1. Whether the Interface or Class is surrounded by “ServiceContract”

    2. Check the web.config or app.config whether there is system.serviceModel node.

    If there is any other issue, please feel free to let us know.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 25, 2017 6:17 AM

All replies

  •  

    [OperationContract]

    The attribute above in the Service Interface specifies that it is a WCF service. WebAPI is a different type of service, limited to HTTP.

    https://www.codeproject.com/Articles/515253/Service-Oriented-Architecture-and-WCF

    Friday, December 22, 2017 5:09 PM
  • Hi MbProgstar,

    Has your issue been resolved?

    As the suggestion from DA924x, your service is WCF Service.

    To check whether it is WCF Service, you could follow below points.

    1. Whether the Interface or Class is surrounded by “ServiceContract”

    2. Check the web.config or app.config whether there is system.serviceModel node.

    If there is any other issue, please feel free to let us know.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 25, 2017 6:17 AM
  • Thanks. This answer helped.

    Is there any specific property for WebAPI services so I can recognize them? Maybe a namespace which they should import always like System.Web.Http?


    • Edited by MbProgstar Wednesday, December 27, 2017 8:38 AM
    Wednesday, December 27, 2017 8:37 AM
  • Hi MbProgstart,

    For WebAPI, you could check whether there is "ApiController" in the class.

        public class ValuesController : ApiController
        {
            // GET api/values
            public IEnumerable<string> Get()
            {
                return new string[] { "value1", "value2" };
            }
        }

    If there is no other issue, I would suggest you mark the helpful reply as answer to close this thread.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 27, 2017 8:42 AM