Diff between WCF service library and WCF service application
Asked Answered
W

1

7

I want to use WCF service (.svc) in my WPF project., Iam trying to create a service., but in Visual studio we have "WCF service library" and "WCF service application". I tried both.

When we create "WCF Service application" we will get .svc file., that when we host we will get .svc file as a service referece.

But What about the "WCF service Library" project? When i create this i got only .cs files and i tried to added new .svc files, but we doesnt have the option to add .svc files. Please guide me how to use the services created by "WCF service library" project in My WPF application

Web answered 18/2, 2013 at 19:37 Comment(7)
A WCF Service library is a DLL. It has to be hosted (IIS, self-host, windows service, etc). A WCF Service Application is just that - an IIS-hosted WCF service. A WCF Service Library gives you the ability to host the same service a variety of ways without having to rewrite the same code in each instance.Moonshiner
OK.. WCF Service library is a DLL. I will write all my API's in service.cs., this service dll i want to add to my wpf application. IF i use .svc, i can added using "Add service reference" then what about service.cs dll., is it same how we add a normal "dll" filesWeb
Do you want your WPF app to host the service, or make calls to the service?Moonshiner
To make calls to the serviceWeb
Then you need to host the service somewhere. See the link in Dhawalk's answer for your options.Moonshiner
check out my blog post, this might help: code-zest.blogspot.com/2013/10/…Helianthus
See also this question: #1204865Viviyan
C
1

Services created in WCF service library can be hosted using multiple paradigms. The following link (pretty old) explains various ways of histing a wcf service.

http://msdn.microsoft.com/en-us/library/bb332338.aspx

please note that you need .svc file if you are hosting your wcf service in IIS. you can write your own host and will not require .svc file

Curacy answered 18/2, 2013 at 19:47 Comment(7)
OK.. WCF Service library is a DLL. I will write all my API's in service.cs., this service dll i want to add to my wpf application. IF i use .svc, i can added using "Add service reference" then what about service.cs dll., is it same how we add a normal "dll" filesWeb
If this is .NET 4.0+, a .svc file is no longer needed to host in IIS.Moonshiner
@Tim, Thanks.... Anusha, for services in a dll, you will have to have a way of hosting the service before you can use it as a web service. untill then, they are simple service defintion classes. For you case, I would recommend that you use the WCF service application. also, read up a lot on WCF as its a vast oceanCuracy
Thanks Dhawalk., I did one project using "WCF service application", hosted in a server and i referred those .svc files in my application and calling the services. Now Iam checking how to do with "WCF service library" :)Web
here's a code project link that might help codeproject.com/Articles/38160/…Curacy
I also noted that if I use a WCF Service Application I can't just run the service by clicking F5..meaning compared to a WCF Service "Library" template, the WCF Service "Application" doesn't have a debug tab with /client:"WcfTestClient.exe". So I end up with no way to just run my service straight up with F5 and continue to add TAD (non TDD unit tests) while having the service run. The only way I can force the service to run in the "Applications" type of WCF template is to right-click the .svc and say open in browser which starts the service in IIS Express automatically which is not desiredHelianthus
I say not desired to my last post because I want people to be able to open my solution, start the WCF service when they click F5 and be able to see GREEN on my unit tests that are using the client proxy instance. If the service is not running they have to know to go other routes like set it up manually in IIS or like I said, right-click the service in the WCF Service Application project and choose to open it in browser option in the context menu which forces them to use the IIS Express route IF they know to even do this. I want them to be able to run the service via F5Helianthus

© 2022 - 2024 — McMap. All rights reserved.