-1

I have two .cs files in one i will specify the Interfaces, and in another file i will implement the interfaces. Now i want to host Service as a WCF Service on IIS. In another way How to host the already existing service(Functionality) as a WCF Service. Thanks in advance.

realn
  • 1,732
  • 3
  • 12
  • 20

1 Answers1

2

You have several options:

  1. put your two *.cs files into your App_Code directory in a web site and let ASP.NET compile then as needed. You will need to create a service file something like this:

    YourService.svc

    <%@ ServiceHost Language="C#" Debug="true" 
        Service="YourService" CodeBehind="~/App_Code/YourService.cs" %>
    
  2. put your two *.cs files into a separate class-library project and compile them into a DLL which you put into the \bin directory in your web site/web application. You will need to create a service file something like this:

    YourService.svc

    <%@ ServiceHost Language="C#" Debug="true" Service="YourService"  %>
    

This service file tells the IIS runtime how to handle incoming requests for the http://(yourserver)/(virtualdirectory)/YourService.svc URL.

Now, once everything is setup, you should be able to connect to your service at the service URL using a tool like the WCF Test Client to send SOAP requests (and receive back responses)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459