Re: Error : Cannot serialize member

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jan Tielens (jan_at_no.spam.please.leadit.be)
Date: 04/26/04


Date: Mon, 26 Apr 2004 22:18:36 +0200

Probably have a return value or parameter of the Site type. This class
cannot be serialized so it can not be used as a return value of parameter of
a web service.

-- 
Greetz,
Jan
________________________
Read my weblog: http://weblogs.asp.net/jan
"Humair Ahmed" <humair@axact.com> schreef in bericht
news:%232GrsT4KEHA.1264@TK2MSFTNGP12.phx.gbl...
>
> Server Error in '/IISManage' Application.
> --------------------------------------------------------------------------
--
> ----
>
> Cannot serialize member System.ComponentModel.Component.Site of type
> System.ComponentModel.ISite because it is an interface.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.NotSupportedException: Cannot serialize member
> System.ComponentModel.Component.Site of type System.ComponentModel.ISite
> because it is an interface.
>
> Source Error:
>
>       An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
>
> Stack Trace:
>
> [NotSupportedException: Cannot serialize member
> System.ComponentModel.Component.Site of type System.ComponentModel.ISite
> because it is an interface.]
>    System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean
> canBePrimitive, MemberInfo memberInfo)
>    System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo
> source, Boolean directReference)
>    System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo
> source)
>    System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo
> propertyInfo)
>    System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo
memberInfo)
>
>
System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(Struc
> tModel model, String ns)
>
>
System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(Struc
> tModel model, String ns)
>
> System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
> model, String ns, ImportContext context, String dataType, Boolean repeats)
>
> [InvalidOperationException: There was an error reflecting type
> 'System.DirectoryServices.DirectoryEntry'.]
>
> System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
> model, String ns, ImportContext context, String dataType, Boolean repeats)
>
> System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
> model, String ns, ImportContext context, String dataType)
>
>
System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberM
> apping accessor, FieldModel model, XmlAttributes a, String ns, Type
> choiceIdentifierType)
>
>
System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflec
> tionMember xmlReflectionMember, String ns, XmlReflectionMember[]
> xmlReflectionMembers)
>
>
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlRefle
> ctionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement)
>
> [InvalidOperationException: There was an error reflecting 'objObject'.]
>
>
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlRefle
> ctionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement)
>
> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String
> elementName, String ns, XmlReflectionMember[] members, Boolean
> hasWrapperElement)
>
>
System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflecti
> onImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean
> serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use,
SoapParameterStyle
> paramStyle, String elementName, String elementNamespace, Boolean
> nsIsDefault, XmlReflectionMember[] members, Boolean validate)
>
>
System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo
> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
> SoapReflectionImporter soapImporter, String defaultNs)
>
> [InvalidOperationException: Method Service1.displayshildren can not be
> reflected.]
>
>
System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo
> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
> SoapReflectionImporter soapImporter, String defaultNs)
>    System.Web.Services.Description.SoapProtocolReflector.ReflectMethod()
>
>
System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBi
> nding reflectedBinding)
>    System.Web.Services.Description.ProtocolReflector.Reflect()
>
>
System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(
> ProtocolReflector[] reflectors)
>
System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type
> type, String url)
>    System.Web.Services.Protocols.DocumentationServerType..ctor(Type type,
> String uri)
>    System.Web.Services.Protocols.DocumentationServerProtocol.Initialize()
>    System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
> HttpContext context, HttpRequest request, HttpResponse response)
>    System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
> HttpContext context, HttpRequest request, HttpResponse response, Boolean&
> abortProcessing)
>
> [InvalidOperationException: Unable to handle request.]
>    System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
> HttpContext context, HttpRequest request, HttpResponse response, Boolean&
> abortProcessing)
>
> System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
> type, HttpContext context, HttpRequest request, HttpResponse response)
>
> [InvalidOperationException: Failed to handle request.]
>
> System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
> type, HttpContext context, HttpRequest request, HttpResponse response)
>
>
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContex
> t context, String verb, String url, String filePath)
>    System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
> requestType, String path, String pathTranslated, Boolean useAppConfig)
+699
>
>
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
> .Execute() +95
>    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
> completedSynchronously) +173
>
>
>
> We encounter that problem when i am running my service with this code
>
>
>
> Imports System.Web.Services
>
> <System.Web.Services.WebService(Namespace :=
> "http://tempuri.org/IISManage/Service1")> _
>
> Public Class Service1
>
> ' WEB SERVICE EXAMPLE
>
> ' The HelloWorld() example service returns the string Hello World.
>
> ' To build, uncomment the following lines then save and build the project.
>
> ' To test this web service, ensure that the .asmx file is the start page
>
> ' and press F5.
>
> '
>
> '<WebMethod()> _
>
> 'Public Function HelloWorld() As String
>
> ' Return "Hello World"
>
> 'End Function
>
> <WebMethod()> _
>
> Public Sub displayshildren(ByVal objObject As
> DirectoryServices.DirectoryEntry, ByVal strSpaces As String)
>
> Console.WriteLine(strSpaces & objObject.Name)
>
> Dim objChild As DirectoryServices.DirectoryEntry
>
> For Each objChild In objObject.Children
>
> displayshildren(objChild, strSpaces & " ")
>
> Next
>
> End Sub
>
> <WebMethod()> _
>
> Public Function returnSite(ByVal objObject As
> System.DirectoryServices.DirectoryEntry) As String
>
> 'Dim SiteArr(0) As String
>
> Dim SiteArr As String
>
> Dim objChild As DirectoryServices.DirectoryEntry
>
> For Each objChild In objObject.Children
>
> SiteArr = objChild.Name
>
> Next
>
> Return SiteArr
>
> End Function
>
> End Class
>
>
>
> --Can any one give me a solution to that.?
>
>


Relevant Pages

  • Re: Add Web Reference Error
    ... >> strCountryStart As String) As SqlDataReader ... >> System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean ... >> HttpContext context, HttpRequest request, HttpResponse response, Boolean& ...
    (microsoft.public.dotnet.distributed_apps)
  • Serialization Question
    ... System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean ... xmlReflectionMember, String ns, XmlReflectionMemberxmlReflectionMembers) ... HttpContext context, HttpRequest request, HttpResponse response, Boolean& ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem with webservice returning an array (You must implement a d
    ... >> Public Function GetTitlesForBin(ByVal BinNum As String) As Array ... >> System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean ... >> HttpContext context, HttpRequest request, HttpResponse response, Boolean& ...
    (microsoft.public.dotnet.framework.webservices)
  • MOSS Search Recurrent Event Log Errors
    ... (VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, ... (HttpContext context, VirtualPath virtualPath, Boolean noBuild, ... (HttpContext context, String verb, String url, String filePath) ...
    (microsoft.public.sharepoint.portalserver)
  • Problem with webservice returning an array (You must implement a default accessor on System.Array be
    ... Public Function GetTitlesForBin(ByVal BinNum As String) As Array ... System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean ... xmlReflectionMember, String ns, XmlReflectionMemberxmlReflectionMembers) ... HttpContext context, HttpRequest request, HttpResponse response, Boolean& ...
    (microsoft.public.dotnet.framework.webservices)