I have created a new "WCF service library" type project. I have created a file for my contract and one file which implements the interface. Both files have the .cs extension.
Please can anyone tell me how can I consume it. I mean where should I add my .svc file
A . svc file contains a WCF-specific processing directive (@ServiceHost) that allows the WCF hosting infrastructure to activate hosted services in response to incoming messages. This file contains the details required for WCF service to run it successfully.
You have to create another project - Web application or WCF Service application (generally it is the same as Web application with some added references). Then you have to reference your service library in the new project and add .svc file. Delete code behind file from newly created .svc file and open markup of that file. Modify Service attribute of @ServiceHost directive. The attribute has to point to your service implemented in library (full name with namespace). Then add configuration to web config.
If you use WCF 4.0 you don't have to create configuration (default will be used) and you even don't need to define .svc file. WCF 4.0 supports configuration based activation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With