2
Answers

WCF service Library. Where to add . svc file

Roy Keane

Roy Keane

14y
10.5k
1

Hi,

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 are .cs files.

Please can anyone tell me how can i consume it. I mean where should i add my .svc file

Answers (2)
0
Sobo Bo

Sobo Bo

NA 38 0 14y

1. Create an asp.net web application.
2. Add new item to the web app and choose wcf service.
    -- You will have 2 files .svc and .svc.cs
3. Right-click the .svc file and click View Markup from the menu.
    -- You will see something like this:
<%
@ ServiceHost Language="C#" Debug="true" Service="Test.Web.Service" CodeBehind="Service.svc.cs" %>
4. Replace "Test.Web.Service" with the namespace from your wcf library.
5. Replace "Service.svc.cs" with the .cs file from your wcf library.
6. You can now delete the Service.svc.cs file from your web app.

That's it.


Hope that helps.
 
0
Mahesh Chand

Mahesh Chand

1 287.4k 123.7m 14y
In your client project in which you want to consume the WCF service, right click and select Add Service Reference and it will ask you to browse the svc file. Your service must be running at that time.