Reputation: 29720
Ive written a service and it has a .svc file. I can browse to this service but this seems to be a strange way of doing it. Im wondering whether is okay to produce a service using a .svc file or should we be looking at using the WCF Service Host and setting up the bindings etc....
Upvotes: 19
Views: 45657
Reputation: 8488
An svc file is for when you're hosting within IIS (it can now host without these in .NET 4.0). Unless you have a reason to self host I'd strongly recommend sticking with IIS (WAS) as it provides so much of the hosting infrastructure for "free".
UPDATE (11/16): Updated broken link to point to a comparative ASP.NET forums post. Previous link was here in case it comes back to life sometime in the future.
Upvotes: 13
Reputation: 46591
Well, In WCF you are not restricted to hosting in just IIS. The .svc file is equivalent to an asmx file. If you are going to host in IIS, I have used the .svc file, but if I am hosting in a console app or windows service, I instantiate the service through ServiceHost.
Upvotes: 9
Reputation: 720
As far as I know, the .svc file is needed when hosting your service in IIS. If you want to host your service otherwise (eg. by instantiating a service host in code), you should not need it.
That being said, I personally prefer using IIS for service hosting.
Upvotes: 5