Friday, February 11, 2011

WCF Web Services The Easy Way

In fact, we are going to setup WCF web services without any configuration!
To make it even more simple, you could move the code for the service out of the CodeBehind file and into the .svc file. Now you have an entire WCF service in a single file! Check it out:

http://www.codethinked.com/post/2010/08/17/WCF-Web-Services-The-Easy-Way.aspx
http://twitter.com/JustinEtheredge

<%@ ServiceHost Language="C#"
Service="MyTestWebsite.MyTestService"
Factory="System.ServiceModel.Activation.ServiceHostFactory" %>
using System.ServiceModel;

namespace MyTestWebsite
{
[ServiceContract]
public class MyTestService
{
[OperationContract]
public string DoWork()
{
return "Did Something!";
}
}
}

No comments:

Post a Comment