简体   繁体   中英

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. I create it with no problems.

  • I want to implement the service interface creating a service of mine. So I implement the Service interface.

  • I create a svc file:

     <%@ 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.
Only XmlElement, XmlArray, XmlArrayItem, XmlAnyAttribute and XmlAnyElement attributes
are supported when IsWrapped is true.

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.

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.
But I would like to use WCF...

This link shall help you, it has direct explanation of the problem and possible way-outs.

I had the same issue with the OPC DA specification. I switched to the old-style .NET Webservices (web reference instead of service reference). The .NET webservices do accept the WSDL specification of the OPC foundation.

These are the steps I took to create such a proxy:

  1. Create a .NET v2 project.
  2. Add a Web reference to http://www.opcfoundation.org/webservices/XMLDA/1.0
  3. Adjust the project settings, so it compiles for .NET v4 again.
  4. Use the proxies.

It's not an ideal solution, but it's beats creating your own wrapper.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM