Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista Tutorial - VS2008 and WCF

 
 
Old 04-03-2008   #1 (permalink)
JIGNESH
Guest


 
 

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
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();
}



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Windows 7 VS2008 .NET General
VS2008 SP1 .NET General
VS2008 new projects .NET General
Upgrading from VS2008 standard to VS2008 Pro? .NET General
upgrade from VS2008 standard to VS2008 pro- options? .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46