You have basically two options, I believe:
Option 1 - Deploy "bin" (Preferred Option)
- compile your WCF service into a DLL (class library)
- create a website in IIS6
- copy the WCF DLL to the
.\bin the website - create a
*.svc file on this website - add the appropriate
web.config to the website folder to determine the endpoints and configuration of the service, etc.
Your WCF service will now be available at the base address of the website plus the *.svc file name, for example
http:
Your *.svc will look something like this:
<%@ ServiceHost Language="C#" Debug="true" Service="WCF_Simple_Service.HelloIndigoService" %>
Service= attributes mean a class that implements a service that is fully consistent with its namespace.
Option 2 - enter material in App_Code
- create a website in IIS6
- put all WCF-related
*.cs files directly into the .\App_Code folder - create a
*.svc file on this website - add the appropriate
web.config to the website folder to determine the endpoints and configuration of the service, etc.
Your WCF service will now be available at the base address of the website plus the *.svc file name, for example
http:
Your *.svc will look something like this:
<%@ ServiceHost Language="C#" Debug="true" Service="Service" CodeBehind="~/App_Code/Service.cs" %>
A simple web.config example might look something like this:
<system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="WithDebug"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> <services> <service name="SimpleWCF.HelloIndigoService" behaviorConfiguration="true"> <endpoint address="" binding="basicHttpBinding" contract="SimpleWCF.IHelloIndigoService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel>
Basically, you define your <service> - and again: name= denotes a class that implements the service - fully matching its namespace. It must contain at least one endpoint - since IIS6 only supports HTTP, you can use wsHttpBinding or wsHttpBinding , and thatβs all there is to it. The "mex" endpoint is optional but very useful, especially for development and testing. It allows the client to "discover" the service and get its description of the service so that it can interact with it.
Once your service is deployed to IIS, you can see it in action using a tool such as the WCF Test Client , which ships with WCF for free, or SoapUI , which is a universal SOAP testing utility (with a free version for you).