【问题标题】:Why is WCF generating a different proxy?为什么 WCF 生成不同的代理?
【发布时间】:2012-03-02 07:42:13
【问题描述】:

我正在向 Peoplesoft WSDL 添加服务引用。现有应用程序具有在不同版本的 .NET(我认为是 4.0)或 svcutil 中生成的代理。旧的代理是这样开始的:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.235
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace PeopleSoft.CustomerService {
    using System.Runtime.Serialization;
    using System;


    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.CollectionDataContractAttribute(Name="CIFaultTypeShape", Namespace="http://xmlns.oracle.com/Enterprise/FSCM/schema/M866879.V1", ItemName="IBResponse")]
    [System.SerializableAttribute()]

但是新的代理看起来像这样:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.239
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Tasks.Services.ServiceReference1 {


    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xmlns.oracle.com/Enterprise/FSCM/schema/M866879.V1")]

很明显,相同的 WSDL 会导致不同的代理类。我们有旧代码依赖于代理类中没有生成的 FaultType (CIFaultTypeShape)。

这是导致该 FaultType 被忽略的 WCF 问题吗?

【问题讨论】:

  • 第一个代理是使用 svcutil.exe 生成的,而第二个是使用 Visual Studio 中的添加服务引用生成的吗?问题可能在于使用了不同的序列化程序(Xml 与 DataContract)。
  • 谢谢,但我们将其追溯到 VS 2010 的错误。

标签: wcf


【解决方案1】:

我们经历了与此博主相同的场景(VS2008 代理和 VS2010 代理之间的差异):

http://www.fransson.net/blog/cannot-access-faultexception-details/

“在与 Microsoft 的 Andrea Liberatore 进行了一些沟通后,他联系了 Microsoft 产品组,他们确认我实际上在 Visual Studio 2010 中发现了一个错误。”

这是有道理的,因为代理缺少故障类型。

【讨论】:

    猜你喜欢
    • 2018-07-24
    • 2010-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多