使用Windows身份验证传递时生成XML文档时发生错误
问题描述:
我已经设置了基本的http WCF服务,并且我的IIS中的应用程序被配置为使用Windows身份验证。因此使用Windows身份验证传递时生成XML文档时发生错误
的绑定有以下安全设置:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" />
<message clientCredentialType="Certificate"/>
</security>
每个经营合同具有以下属性
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
和服务类具有以下属性允许ASP保持兼容
[AspNetCompatibilityRequirements(RequirementsMode =
AspNetCompatibilityRequirementsMode.Allowed)]
将Windows身份验证传递给W CF服务正常,因为我可以看到/生成WSDL。然而,当我在我的WCF服务调用的操作我得到以下错误:
[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
这不是我第一次看到错误时出错生成XML文档。,我想知道这可能是什么原因?服务是否将数据加密发送并且客户端不理解它,因为它是未配置的?
答
貌似你不处理你的代码的异常/故障,您可能希望确保您的正确序列化的错误,使用以下
http://blogs.msdn.com/b/pedram/archive/2008/01/25/wcf-error-handling-and-some-best-practices.aspx
我还发现一个博客条目从迈克Taulty非常好于WCF
enableing记录http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2005/12/15/5662.aspx
希望这有助于。
我会仔细研究一下,非常感谢! – 2010-06-24 08:13:28
错误似乎是:''给定的程序集名称或代码库,'C:\ Windows \ Microsoft.Net \程序集\ GAC_MSIL \ System.Xml \ v4.0_4.0.0.0__b77a5c561934e089 \ System.Xml.dll',是无效“,即使该文件在那里。 strage。 – 2010-06-28 08:13:48
它也许那你的web.config和参考DLL可以在
Iain
2010-06-28 09:01:27