Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums

Go Back   Vista Forums > Vista technology newsgroups > Indigo

VS2008 and WCF

Reply
 
Thread Tools Display Modes
Old 04-03-2008   #1
JIGNESH
Guest
 
Posts: n/a

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


  Reply With Quote

Reply

Thread Tools
Display Modes









Vistax64.com 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 2005-2008

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 47 48