![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br>
|
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||
|
Guest
Posts: n/a
|
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 VS2008 ERROR when adding a ServiceReference form Client when service is up and running There was an error downloading 'http://localhost:8000/HelloService/MyService'. The request failed with the error message: -- <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring 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, None).</faultstring></s:Fault></s:Body></s:Envelope> --. Metadata contains a reference that cannot be resolved: 'http://localhost:8000/HelloService/MyService'. 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. CODE [ServiceContract] public interface IDataService { [OperationContract] DataSet GetEmployeeRecords(); [OperationContract] int FindNoOfRecords(); } public class Employee : IDataService { #region IDataService Members public DataSet GetEmployeeRecords() { DataSet ds = new DataSet(); ds.ReadXml(@"D:\NewTry\WCFs\WCFServiceLibraryX\WCFServiceLibraryX\EmployeeXMLFile.xml"); return (ds); } #endregion 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), baseAddress)) { serviceHost.AddServiceEndpoint(typeof(IDataService), new BasicHttpBinding(), "MyService"); serviceHost.Open(); Console.WriteLine("Press <enter> to terminate service"); Console.ReadLine(); serviceHost.Close(); } |
||
|
|
|
|