We recently ran into a fun little problem at work after adding a new operation to our WCF service. The first step for us after adding a service is to make that service call available to our client by regenerating the proxies it uses. We do this by running our service and using SvcUtil against it. Today though we ran into an interesting little problem where SvcUtil was telling us that the machine was not accepting connections. We checked back and our service (self hosted I should point out) was still running fine.
So at this point we started the debugging process. First step was to check all our log points which turned up nothing. The SvcUtil error message mentions checking for an inner exception but it doesn't mention how to go about doing that. The fact our service wasn't throwing an error made this even more difficult to debug. So now we started the process of elimination. Taking a look at the code the one thing I did notice was that the only "different" thing the new code did was return an enum as part of the [DataContract]. I looked at the enum and everything looked
fine (yes that was foreshadowing..) but I still thought it was the most likely candidate so I commented it out and tried again. Everything worked fine. At this point I went and looked at the enum declaration again.. it actually looked like this..
public enum AuditType
Insert = 1,
Update = 2,
Delete = 4
Now if you've done any WCF work hopefully the [DataMember] will pop out at you immediately since that is typically used to identify properties. A quick search on Google identified [EnumMember] as the proper attribute and we were off to the races.
So first off I'm hoping someone somewhere finds this and saves themselves a little bit of hunting.. but most importantly I'm hoping someone can help me identify a better way to have figured this out. The service compiled and ran fine. I could not find a single error anywhere but this just seems very wrong. So to you I ask.. what would you have done differently to have found this quicker?
* I wonder if tracing would have helped?
posted @ Thursday, April 15, 2010 9:32 AM