wcf

N-Unit testing WCF with Callbacks

Hi All, I am unit testing a WCF service. The flow goes like this. Application(Client) insert command to the DB through Webservice1. This is done using duplex pattern.(with callbacks). WebService1 inserts the command to DB and this Webservice1 invokes another webservice2 about the arrival of new command.(Duplex pattern). Webservice2 ...

Wcf async pattern doesn't throw Fault Exception

I have a service that implement the Async pattern: [OperationContract(AsyncPattern = true)] IAsyncResult BeginLoadDocument(Byte[] value, AsyncCallback callback, object state); Boolean EndLoadDocument(IAsyncResult asyncResult); The "BeginLoadDocument" run a private method "CallBack" in the service side using a ThreadPool: public IAsy...

WCF REST with a clean URL

I'm considering to host WCF Rest Service that i've built on IIS 7. The URL to access my service will be something like api.mycompany.com/applicationName/Service.svc/users/1347 Recently, i've been looking to some REST API implementation with a clean URL like Yahoo API social.yahooapis.com/v1/user/{guid}/contacts I'm wondering what wi...

what baseAddress of WCF service when publish at hosting?

Hey, I have services on my application and when I test it on localhost everuthing was ok. But when I publish it I have problem with base Address property. What should I put there ? My web.config part: <services> <service name="WcfService1.Service1" behaviorConfiguration="metadataBehavior"> <endpoint address="" binding="basicHttpB...

.NET WCF: Proxy lifecycle management with DuplexChannelFactory

I'm a little unclear on what the proper way is to use DuplexChannelFactory in WCF. Following from convention, I have explicit Connect/Disconnect methods on my service contract to aid in management of the proxies, but I'm a little unclear as to what the client should be doing. Here's my impression of how things work. When initiating the ...

Custom WebFaultException on WCF Rest Serialization Failure?

With an object like this: [DataContract] public class SampleItem { private int _id; [DataMember(IsRequired = true)] public int Id { get { return _id; } set { _id = value; } } private string _stringValue; [DataMember()] pu...

Regenerating Proxy for WCF Service

We are providing WCF services to various clients, one of them is getting the following error. After googled, I found that since client exceeded its idle time, they have to regenerate the proxy again in order to make another call. Now my question, My understanding of this problem is correct? How to make service call withour regenerating t...

WCF NetTcpBinding and load balancing

Hi, I have two instances of a WCF service exposing NetTcpBinding endpoints in the application tier, which are consumed by the application tier (heavy traffic website). I need to load balanced these instances under a single VIP. Considering the tcpNet connection pooling, it is recommended to configure the load-balancer as sticky IP, and...

How do I connect my Silverlight app to a WCF Service?

I've been looking for this answer, and all I found was this link, but when I attempted to follow the tutorial I failed hard. What I need is to connect my Silverlight application to a database, just to show informations from a specific table. As I don't want to use the same ORM for my page and my silverlight app, I created a new WCF webse...

wcf and unstable connection

Hi All, I have a wcf service hosted in iis. The endpoint uses wsHttpBinding. I have a lot of clients that are using the service. The internet connection is unstable. The clients uses the service to insert data in db. What is the best practice of exception handling in the client. Is it good choise to use the using statemen and initi...

WCF Service Design

We currently have a WCF Service which is beginning to reach it's limits performance wise. We have decided to add another server which will host another instance of the WCF Service. We have web applications which must communicate with a specific server based on context... e.g. If the web application is dealing with objects from ServiceI...

WCF Tcp Binding "The requested address is not valid in its context" Error

I have a WCF server using a netTcpBinding and a client. When I run them locally they work fine. If I put the server on a Windows Server 2008 machine and try to run it, it fails unless I change the address to localhost, but no clients can connect to it. I can run the client from the server to connect to a Windows Xp machine running th...

WCF Multiple Endpoints Under IIS7

I have a simple WCF service that we are developing... We are hosting in IIS7 on WinServer2k8 (though i cant get it to work in IIS7 on Win7 either) I want multiple endpoints for the same service contract but have the endpoints behave differently. For example I want one endpoint to return data as XML and another to return data in SOAP mes...

How do I add an unsigned SAML token/assertion to a WCF client using a custom binding?

I'm using SAML 2.0 and have figured out how to add my token to the soap header when using transport security (https) - see this post, but now I need to do this over http without the digital signature on the SAML token. When i use this binding: private static System.ServiceModel.Channels.Binding BuildCustomBindingPIX_SAML() { ...

How can I get the port that a WCF service is listening on?

I have a net.tcp WCF service, and I would like the OS to pick the port that it should listen on. So I have set the port to 0 in my URI, and netstat confirms that the OS has picked a port in the 5000 range. How can I find the actual port that has been picked, in code, inside the service process? Some code to show what I have tried: Ty...

Returning wcf/json result from the wcf service.

Hi All, I Need by service contract to return the xml/json result depending on the request type.I also need a kind of helper function which will convert my result set (i am using linq to sql) so that i do not need to create the xml format for the result set by iterating through the table row many times.What is the suitable way to do that...

How to pass a lot of data between two computers

What are possible options to transfer a lot of data from one computer to another not in the same LAN. The amount of data is about 100Mb unzipped and 2Mb zipped? Another requirement is that when I create a server for this (with C#) Java clients should be able to consume it. Does WCF support something like this? But if Java clients won't...

wcf connection handling best practice

Hi All, I have a wcf client. What is the best way of handling connections ? Is it to open and close every time you need to contact the service: void doSomething(){ MyService service = new MyService(); //try service.doThis(10); ... service.doThat(20); service.Close() // catch } Or should I...

best practice for handling connection errors

What is the best workflow taken when connection error occurs. Let say we have a client that connects to the middle tier. class MyClient{ ... void callServer(){ try{ middletier.saveRecord(123); }catch(...){ // log the error // what to do next (notify the user, take the same step again)? ...

WCF Custom Message Writing With Transaction Support

Hi All I'm using a custom message that inherits the System.Servicemodel.Channels.Message. My custom message get IEnumerable collection which pulled from a database. The WCF service is transactional (which is already tested). MS-DTC is enabled. Problem is, that when the protected override void OnWriteBodyContents(XmlDictionaryWriter...