Filip Ekberg
Filip Ekberg

Reputation: 36287

There was an error generating the XML document when using Windows authentication pass-through

I've set up a basic http WCF Service and my application in IIS is configured to use Windows Authentication.

The bindings therefore have the following security settings:

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="Windows" proxyCredentialType="None" />
    <message clientCredentialType="Certificate"/>
</security>

Each operation contract has the following attribute

[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]

and the service class has the following attribute to allow asp compability

[AspNetCompatibilityRequirements(RequirementsMode = 
                              AspNetCompatibilityRequirementsMode.Allowed)]

The Windows authentication is passed to the WCF service properly, since I can see/generate the WSDL. However, when I call an operation in my WCF service i get the following error:

[FaultException`1: There was an error generating the XML document.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,
                                                        IMessage retMsg) +4767763
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, 
                                                        Int32 type) +1725
   XXXX.Service() +0
   XXXX.Service() +329
   XXXX.Service() +747
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, 
                                                     Object t,EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, 
                                    Boolean includeStagesAfterAsyncPoint) +3048

It's not the first time i see the error There was an error generating the XML document., I want to know what could be the reason for this? Does the Service send the data somewhat encrypted and the client doesn't understand it because it is miss-configured?

Upvotes: 1

Views: 2324

Answers (1)

Iain
Iain

Reputation: 6452

Looks like the you are not handling an exception/Fault in your code, you may want to ensure your serialising the error correctly, using the following

http://blogs.msdn.com/b/pedram/archive/2008/01/25/wcf-error-handling-and-some-best-practices.aspx

I have also found a blog entry from Mike Taulty very good for enableing logging in WCF

http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2005/12/15/5662.aspx

Hope this helps.

Upvotes: 1

Related Questions