tags:

views:

392

answers:

2

I have a WCF service which works perfectly when deployed in our dev and test environments, but which falls over in the production environment.

When attempting to browse to the service, the following exception is thrown (inner exception type is InvalidDataContractException):

[ServiceActivationException: The service '/IL.Party.WS/Party.svc' cannot be activated due to an exception during compilation. The exception message is: Type 'IL.Party.MS.Person' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute..]

I can't figure out what's going on here. All three environments are Windows Server 2003, IIS6 and .NET 3.5. On the server where the service fails, I have gone as far as deleting the temp. ASP.NET files to force a recompile. The same code is deployed across all three environments. If 'IL.Party.MS.Person' was not serializable I would expect to get this error in all three environments. The Person type has fields of type string, int, DateTime and decimal - so nothing out of the ordinary and definitely serializable.

Does anyone have an idea as to what could be causing this?

A: 

Did you try recycling the App Pools? It's best practice to explicit mark you DataContracts so I would apply those attributes as well. Is it possible that your vdir http activation is misconfigured?

Adam Fyles
Recycled, iisreset, server reboot. Pretty much covered my bases there. It's probably the fact that in the production environment .NET 3.5 is isntalled, while in dev and test its .NET 3.5 SP1 (see above).
campeytime
A: 

Marc_s actually answered this in the comments.

But it looks like the reason is the changes in the data contract serializer.

http://www.hanselman.com/blog/HiddenGemsNotTheSameOld35SP1Post.aspx

Shiraz Bhaiji
Correct, thanks marc_s. Thanks Shiraz for the extra info. Busy upgrading production to .NET 3.5 SP1 - will report back on whether this fixes it.
campeytime
Working as expected after upgrading to .NET 3.5 SP1. Note that the real cause was the missing [DataContract] and [DataMember] attributes, which should be added, as mentioned by foosnazzy.
campeytime