jreed350z
jreed350z

Reputation: 505

WCF Enterprise Library ExceptionHandling failing when faultcontracttype in other project

Background: I have a WCF project that is using Microsoft Enterprise Library WCF Exception Handling.

We recently decided to move our operation and data contracts into a separate project (.net assembly) called comanynamespace.xxx.WCF.Utilities. After moving the operation and data contracts, I changed the faultContractType namespace to reflect the new assembly.

Now when I launch the web service in VS2010 I get the following error:

Activation error occured while trying to get instance of type ExceptionPolicyImpl, key "WCF Exception Shielding"

I have tried: ensuring the same references exist in both projects and ensuring that both projects are running under .net 4 (no client modes), etc. Neither helped resolve the issue.

Finally, I copied the Service Fault class back into the Web Service project and changed the namespace in the web.config to point back to the local namespace: from:

faultContractType="comanynamespace.xxx.WCF.Utilities.ServiceFault, comanynamespace.xxx.WCF.Utilities.Services"

to:

faultContractType="comanynamespace.xxx.Web.Services.ServiceFault, comanynamespace.xxx.Web.Services"

This does resolve the error, however, now I must have my service fault data contract in both locations.

Does anyone know why I am unable to use a service fault (data contract) in another .net assembly with Microsoft EL WCF Exception Handling?

Upvotes: 0

Views: 535

Answers (1)

jreed350z
jreed350z

Reputation: 505

The problem ended up being that the namespace (second part) of the faultcontracttype was set to

faultContractType="companyname.xxx.WCF.Utilities.Services.ServiceFault, companyname.xxx.WCF.Utilities.Services"

instead of

faultContractType="companyname.xxx.WCF.Utilities.Services.ServiceFault, companyname.xxx.WCF.Utilities"

companyname.xxx.WCF.Utilities is the namespace for the assembly.

Upvotes: 1

Related Questions