I am relatively new to WCF. However, I need to create a service that exposes data to both Silverlight and AJAX client applications. In an attempt to accomplish this, I have
I have had that error before for ServiceModel framework 3.5, and I checked my host's config file. I found it was my cut-and-paste error. My service was pointing to an old non-existing service than the one I am using. It starts working again after I corrected these lines like below:
Note that MyService has to be the name of your contract class in ServiceModel 3.5 BUT IT IS IMyService contract interface in Framework 4.0 -->
namespace InUse {
[ServiceContract]
public interface IMyService
{
[WebGet(UriTemplate = "/GetList/{PATTERN}",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
List GetIDListByPattern(string PATTERN);
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MyService : IMyService
{
List MySample = (new _PointRT()).Sample().Select(r=>r._pointXID).ToList();
public List GetIDListByPattern(string PATTERN) {
return MySample.Where(x => x.Contains(PATTERN)).ToList();
}
}