I created my first WCF service and tested it on my computer, and it works.
The files present are an interface, an implementation of that interface, and an app.config
IIS Hosted .svc
file consists of the @ServiceHost directive and attribute, Service.
<% @ServiceHost Service="MyNamespace.MyServiceImplementationTypeName" %>
The value of the Service attribute is the CLR type name of your service implementation. Using this directive is basically equivalent to creating a service host using the following code in your self hosting console program.
new ServiceHost(typeof(MyNamespace.MyServiceImplementationTypeName ));
And If your self hosted application are using WCF configuration like 'endpoint', 'binding',etc in the app.config, you can also put that in web.config. IIS-hosted service use the same configuration elements and syntax as WCF services hosted outside of IIS. (Except something like you can't control base/endpoint address in IIS-hosted service.) And put your precompiled .dll file to application’s \bin directory of your IIS Site.
And the address of IIS-hosted service will be the address of .svc file. (http://localhost/Application1/MyService.svc).
Please check the below msdn - Deploying an IIS-Hosted WCF Service.
http://msdn.microsoft.com/en-us/library/aa751792.aspx
The thing you need to keep in mind is that IIS is first-and-foremost a web server, and WCF host secondly.
The webserver's job is to render data based on an incoming request. Most of this data is content (the request path correlated directly to a file on the server) but in the case of a WCF service IIS needs to know where to go from here (thus the SVC file and the "directives" to IIS to spin up your service).
All the SVC file is doing is saying that at /x/y/z.svc
I have a WCF service which is capable of a lot more than just server-side pages and content files. So please spin it up, make it available and allow my incoming connections to be processed.
If this were a WCF service hosted on it's own dedicated port, this would be a different story because it's no longer contending with additional requests for /Styles/base.css
in addition to /MyService/GetSomeObject/
.