gpt4 book ai didi

c# - 使用 SvcUtil.exe 创建的服务引用托管 .NET 服务时出现问题 : XmlSerializer errors on Wrapped mode

转载 作者:行者123 更新时间:2023-11-30 13:05:05 25 4
gpt4 key购买 nike

我的问题如下:

  • 在这里 http://www.opcfoundation.org/webservices/XMLDA/1.0/我使用 VS2010 来创建服务引用。我创建它没有任何问题。

  • 我想实现创建我的服务的服务接口(interface)。所以我实现了Service接口(interface)。

  • 我创建一个 svc 文件:

    <%@ ServiceHost Language="C#" 
    Debug="true"
    Service="Full name of the class
    (the class implementing the Service interface)" %>

好的,我明白了:

XmlSerializer attribute System.Xml.Serialization.XmlAttributeAttribute is not valid in LocaleID.
Only XmlElement, XmlArray, XmlArrayItem, XmlAnyAttribute and XmlAnyElement attributes
are supported when IsWrapped is true.

让我指出以下几点:
不要问我要Web.config文件,有没有服务模型配置设置,没有区别,还是一样的问题。

有什么问题?

我一直想解决这个问题,我想指出,在过去,其他人使用 wsdl.exe 来创建一个使用 WebService 的 asp.net 服务引用和 WebMethod 作为服务属性,该方法不会导致此错误。
但我想使用 WCF...

最佳答案

我对 OPC DA 规范也有同样的问题。我切换到旧式 .NET Web 服务(Web 引用而不是服务引用)。 .NET 网络服务接受 OPC 基金会的 WSDL 规范。

这些是我创建这样一个代理所采取的步骤:

  1. 创建一个 .NET v2 项目。
  2. 添加对 http://www.opcfoundation.org/webservices/XMLDA/1.0 的 Web 引用
  3. 调整项目设置,使其再次针对 .NET v4 进行编译。
  4. 使用代理。

这不是理想的解决方案,但胜过创建您自己的包装器。

关于c# - 使用 SvcUtil.exe 创建的服务引用托管 .NET 服务时出现问题 : XmlSerializer errors on Wrapped mode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6249703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com