[英]Problems hosting a .NET service using a service reference created using SvcUtil.exe: XmlSerializer errors on Wrapped mode
My problem is the following:我的问题如下:
Here http://www.opcfoundation.org/webservices/XMLDA/1.0/ I use VS2010 in order to create a service reference.这里http://www.opcfoundation.org/webservices/XMLDA/1.0/我使用 VS2010 来创建服务引用。 I create it with no problems.我创建它没有问题。
I want to implement the service interface creating a service of mine.我想实现创建我的服务的服务接口。 So I implement the Service
interface.所以我实现了Service
接口。
I create a svc file:我创建一个 svc 文件:
<%@ ServiceHost Language="C#" Debug="true" Service="Full name of the class (the class implementing the Service interface)" %>
OK, I got this:好的,我明白了:
XmlSerializer attribute System.Xml.Serialization.XmlAttributeAttribute is not valid in LocaleID. XmlSerializer 属性 System.Xml.Serialization.XmlAttributeAttribute 在 LocaleID 中无效。
Only XmlElement, XmlArray, XmlArrayItem, XmlAnyAttribute and XmlAnyElement attributes仅 XmlElement、XmlArray、XmlArrayItem、XmlAnyAttribute 和 XmlAnyElement 属性
are supported when IsWrapped is true.当 IsWrapped 为真时支持。
Let me point the following:让我指出以下几点:
Do not ask me for Web.config file, whether it has a service model configuration settings or not, it is not different, the same problem persists.不要问我Web.config文件,有没有服务model配置设置,没有区别,同样的问题依旧。
What's the problem?有什么问题?
I've been wondering around to solve this, I would like to note that, in the past, someone else used wsdl.exe in order to create an asp.net service reference that uses WebService
and WebMethod
as service attributes, that approach does not lead to this error.我一直在想解决这个问题,我想指出,过去,其他人使用 wsdl.exe 来创建使用WebService
和WebMethod
作为服务属性的 asp.net 服务引用,这种方法不会导致这个错误。
But I would like to use WCF...但我想用 WCF...
I had the same issue with the OPC DA specification.我对 OPC DA 规范有同样的问题。 I switched to the old-style .NET Webservices (web reference instead of service reference).我切换到旧式 .NET Webservices(Web 参考而不是服务参考)。 The .NET webservices do accept the WSDL specification of the OPC foundation. .NET Web 服务确实接受 OPC 基金会的 WSDL 规范。
These are the steps I took to create such a proxy:这些是我创建这样一个代理所采取的步骤:
It's not an ideal solution, but it's beats creating your own wrapper.这不是一个理想的解决方案,但它比创建自己的包装器要好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.