• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

VS2008 and WCF



I have a trouble with WCF in the following code. Have created a
[ServiceContract] and stuff.
Now i am trying to host by writing code... Host only starts running in
administrator mode. but when client(Vs2008 Add Service Reference) makes a
reference it give error and I have no clue of the source of error. Problem
is we had tried such small stuff in betas and now it not working smothly in

ERROR when adding a ServiceReference form Client when service is up and
There was an error downloading 'http://localhost:8000/HelloService/MyService'.
The request failed with the error message:
xml:lang="en-US">The message with Action '' cannot be processed at the
receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This
may be because of either a contract mismatch (mismatched Actions between
sender and receiver) or a binding/security mismatch between the sender and
the receiver. Check that sender and receiver have the same contract and the
same binding (including security requirements, e.g. Message, Transport,
Metadata contains a reference that cannot be resolved:
Content Type application/soap+xml; charset=utf-8 was not supported by
service http://localhost:8000/HelloService/MyService. The client and service
bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message
because the content type 'application/soap+xml; charset=utf-8' was not the
expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution
and adding the service reference again.


public interface IDataService
DataSet GetEmployeeRecords();
int FindNoOfRecords();

public class Employee : IDataService
#region IDataService Members
public DataSet GetEmployeeRecords()
DataSet ds = new DataSet();
return (ds);
public int FindNoOfRecords()
DataSet ds = GetEmployeeRecords();
return (ds.Tables[0].Rows.Count);


static void Main(string[] args)

Uri baseAddress = new Uri("http://localhost:8000/HelloService");

using (ServiceHost serviceHost = new ServiceHost(typeof(Employee),
serviceHost.AddServiceEndpoint(typeof(IDataService), new BasicHttpBinding(),
Console.WriteLine("Press <enter> to terminate service");

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)