Asked by:
WCF current documentation

Question
-
User202148513 posted
Hi
I am looking into WCF and notice a lot of the documentation appears quite dated and has been written for Server 2003 / Server 2008 / Windows 7 and I can't really find fresh documentation updated for more recent versions of Windows.
If I wanted to get some basic samples going by following the tutorials at
https://docs.microsoft.com/en-us/dotnet/framework/wcf/
https://docs.microsoft.com/en-us/dotnet/framework/wcf/getting-started-tutorial
https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/getting-started-sample
would this be the correct place to start?
Also if I was starting from a completely fresh machine from scratch eg an Azure virtual machine with Server 2016 and Visual Studio 2017 installed, with nothing else, what would be the easiest way of getting a sample WCF application up and running? It's just that the Microsoft pages jump about from one place to another and cater for so many scenarios I want to be careful of not following down the wrong rabbit hole!
What I'm looking for is a start-me-up guide just to start from zero, follow the instructions and get my first 'hello world' WCF client/server application up and running, just to see the mechanics of how it all fits together in practice.
Final question - is the industry in general using APIs rather than WCF technology, or is WCF still used by major companies?
Thanks!
Phil Anderson
Tuesday, September 4, 2018 12:02 PM
All replies
-
User-821857111 posted
WCF is still widely used, but only in the same way as Web Forms - a lot of very large older applications are built with it. Very few new applications are built with it. The recommendation these days is to use Web API (or API controllers in ASP.NET Core: https://docs.microsoft.com/en-gb/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.1).
There is no new documentation for WCF because there is nothing new to say about it. As a technology, it stopped gathering significant new features some years ago. The stuff you find that features older OS versions is just as relevant today. The OS makes little difference - so long as it supports the version of the .NET Framework that you want to use.
Tuesday, September 4, 2018 12:53 PM -
User753101303 posted
Hi,
Try also https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api to see if you should go with WCF or use Web API instead.
Else this doc is still current. It's just that it came out a long time out and I don"t think it should cause any issue if you have to use it.
Tuesday, September 4, 2018 1:17 PM -
User202148513 posted
Thank you very much Mike; very helpful.
One more question then which I'm going to post both to you and Patrice who also has replied
If I'm starting from a clean install of either Server2008/12/16 or Win7/10 then is there a single page document which exists which lays out the steps, in order, for me to get my Hello World WCF application up and running. It's just that I am running a class in C# next week and I want to be able, from scratch, to create a very simple version of WCF from scratch just so we can look at it and discuss it, not so we can take it very advanced but just the trivial case from scratch. It's just that the Microsoft docs have so many different options I'm not sure where is the simple a-b-c setup guide! Hope that makes sense :))) If it's helpful I'm OK with installing IIS no problem.
Thank you
Phil
Wednesday, September 5, 2018 7:06 AM -
User202148513 posted
Thank you Patrice, same comment as to Mike :)
By the way that was a very helpful page which I have not seen, so I will use that in the future - thank you :)
Wednesday, September 5, 2018 7:08 AM -
User753101303 posted
Have you tried https://docs.microsoft.com/en-us/dotnet/framework/wcf/getting-started-tutorial ?
I tend to always use the doc first. This way even if not used right away you get to know what is available. I'm using then 3rd party tutorials when I don't find what I want in the doc.
Wednesday, September 5, 2018 3:53 PM -
User202148513 posted
Thanks - yes I was getting confused as to exactly where to start with these docs, because they have so many links which link to other pages I have no idea which page I'm actually supposed to start on !
So for example this page links to this page
Is this where I should start?
Or perhaps here?
https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-define-a-wcf-service-contract
I'm quite lost and just looking for a fairly easy a-b-c guide which doesn't seem to be here! Are you able to help in any way Patrice?
Thank you
Philip
Wednesday, September 5, 2018 3:59 PM -
User753101303 posted
The later IMO. With Visual Studio and IIS Express you should be ready right away to start coding (if this is what you want to see first).
What is in the "Hosting" section would be when you want to see how the service could run in your environment. As you can see from the main https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/hosting section, the main point is that IIS is not the only option for hosting the service.
Wednesday, September 5, 2018 4:18 PM -
User475983607 posted
philanderson888
yes I was getting confused as to exactly where to start with these docs, because they have so many links which link to other pages I have no idea which page I'm actually supposed to start on !WCF is a very complex and configurable framework that takes years to learn. If all you want is a way to invoke business logic over a hosted HTTP service (IIS) then there is no reason to learn WCF just go with Web API. Can you explain what features of WCF you need? That will help us find an appropriate code sample.
If you really need WCF start with the getting started tutorials.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/getting-started-tutorial
I found the WCF Samples very useful as it covers a wide range of WCF configuration.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/
Wednesday, September 5, 2018 4:46 PM -
User202148513 posted
Thank you
Yes I'm running a C# class and part of the documentation talks about WCF so I wanted to be able to demo the most trivial example possible, from getting a WCF client to send a trivial message to another WCF server/service. I don't really mind which implementation I use; just the most simple and trivial to set up. I did manage to download the samples but got stuck actually running them.
For example I started on this page
https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/getting-started-sample
but it directs me to this page
but I'm not sure how much is relevant in Server 2016 ie points 2,3,4 and 5 are still relevant in 2016 server.
I've downloaded the samples in points 6,7,8 and run Setupvroot.bat in point 9 then I think we are done for that page - I don't need certificates (point 12) for the trivial case do I?
Then going back to this page
https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/getting-started-sample
Point 2 takes me to https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/building-the-samples where I think I'm OK to build the project
But then back to this page again
https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/getting-started-sample
Point 3 takes me to https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/running-the-samples
I think I got stuck at this point
To run the sample on the same machine
-
If the service is hosted by IIS, ensure that you can access the service using a browser by entering the following address: http://localhost/servicemodelsamples/service.svc. A confirmation page should be displayed in response. If the confirmation page is not displayed, see Troubleshooting Tips.
-
If the service is self-hosted, run Service.exe from \service\bin, from under the language-specific folder. Service activity is displayed on the service console window.
-
Run Client.exe from \client\bin\, from under the language-specific folder. Client activity is displayed on the client console window.
-
If the client and service are not able to communicate, see Troubleshooting Tips.
It was just all the jumping around between pages meant I really wasn't sure where I was going or if had missed something trivial so I was wondering if there is a super simple step-by-step guide, all on one page, which exists just for me to work through and get a trivial case up and running. Does that make sense? PS I have passed the 70-483 Microsoft C# exam but I've never dealt with the WCF nor much with IIS before.
Is there some 'easy' guide to running WCF somewhere on the internet, even outside of Microsoft documentation that you guys are aware of?
Thanks :)
If not I will give it another go using just the Microsoft documentation and see if I can do it using these docs alone, and perhaps if I get stuck again come back to you guys for support?
Phil
:)
Wednesday, September 5, 2018 9:18 PM -
-
User475983607 posted
Phil, I've used WCF from the first day it came out and before that it was WSE and before that ASMX. I've had the benefit of seeing the progression of ASP.NET SOAP services over the years. I've built many WCF services that are still in operation today. With all that time, I probably took advantage of about 10% of the capabilities of WCF professionally.
WCF is very complex. I'm looking at your post and to me what you're trying to do is very straight forward. But it has taken me years to get to this point.
To get started, simply create a solution with a WCF application project (service) and a console project (client). The default WCF template comes with two operational contracts and a data contract. In the console app create a service reference that points to the WCF service. The service reference creates code in the console app that allows invoking the operational contracts. Then simply invoke the two operational contracts. See the Getting Started tutorials for details.
Wednesday, September 5, 2018 11:33 PM -
User753101303 posted
If you are not familiar with that, the simplest path is likely to juse use VS/IIS Express and follow https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-define-a-wcf-Ahservice-contract
Ah even better. In VS you can use "Add new item..." and select "WCF Service". The default is that it does nothing but you could easily change that to a Multiply method that accept a and b and return a*b.
I forgot but in VS 2017 Community (and likely a bit earlier) you can even start on service1.svc which triggers a built in test client.
It might take basically 2 minutes to get your first service up and running.
Thursday, September 6, 2018 7:15 AM -
User202148513 posted
Thank you so much for all your input guys; I will pause on the thread and get back to you once I've done some more work and followed up these avenues and clarified what I'm doing! Hopefully these posts will enable me to crack it fairly easily now. Thank you and I'll get back to you within 1 week :)
Thursday, September 6, 2018 8:28 AM -
User202148513 posted
Thank you guys
Now I'm not sure if I'm doing this right but I've created a trivial WCF Application project hosted in Visual Studio which works, and I've created my own DataContract fields as seen below.
{{This chat didn't seem to let me put an image in so I am pasting the link to the image instead}}
https://1drv.ms/u/s!AqdmkFhDCyDCyP4qTkw28VzEH2Rxig
Last step and I think I'll be happy - what are the steps to move this application from being hosted in Visual Studio to host it inside IIS? Are they fairly trivial steps?
Thank you
Philip
Friday, September 7, 2018 10:44 AM -
User1120430333 posted
The key to using WCF is understanding what WCF operational contracts and data contracts are about.
Saturday, September 8, 2018 7:42 PM -
User-330142929 posted
Hi philanderson888,
According to your description,
Last step and I think I'll be happy - what are the steps to move this application from being hosted in Visual Studio to host it inside IIS? Are they fairly trivial steps?Due to the fact that the project you shared through OneDrive has expired, I could not download and check them.
As far as I know, if you want to host the WCF project on the IIS, you could refer to the following official document.
In VS2017, you could create the WCF service project directly and published on the IIS.
Feel free to let me know if you have any questions.
Best Regards
Abraham
Wednesday, September 12, 2018 1:41 AM