Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using a ASP.NET web service to be called from desktop application.

Everything will be going fine still i doesn't added Emugu CV (Dot net wrapper of OpenCv) in code of web service.

Even no problem for using EmguCV namespace. But, problem starts when i will include, the EigenObjectRecognizer and its objects in a code.

Here is the code;

C#
public class classify : System.Web.Services.WebService
{
    public classify()
    {
        //Uncomment the following line if using designed components 
        //InitializeComponent();         
    }

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }

    [WebMethod]
    public string InitApp(out EigenObjectRecognizer Face, out EigenObjectRecognizer Eye, out EigenObjectRecognizer Nose, out EigenObjectRecognizer Mouth)
    {
        return LoadApp(out Face, out Eye, out Nose, out Mouth);
    }

    public string LoadApp(out EigenObjectRecognizer Face, out EigenObjectRecognizer Eye, out EigenObjectRecognizer Nose, out EigenObjectRecognizer Mouth)
    {
        ClassifyAG cag = new ClassifyAG();
        string load_result = cag.InitData(out Face, out Eye, out Nose, out Mouth);
        return load_result;
    }
}


Here is the error:

C#
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.MissingMethodException: No parameterless constructor defined for this object.

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:


[MissingMethodException: No parameterless constructor defined for this object.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +206
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.Activator.CreateInstance(Type type) +11
   System.Xml.Serialization.SerializableMapping.RetrieveSerializableSchema() +752
   System.Xml.Serialization.XmlSchemaExporter.ExportSpecialMapping(SpecialMapping mapping, String ns, Boolean isAny, XmlSchemaElement element) +1269
   System.Xml.Serialization.XmlSchemaExporter.ExportElementMapping(XmlSchemaElement element, Mapping mapping, String ns, Boolean isAny) +268
   System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessor(XmlSchemaGroupBase group, ElementAccessor accessor, Boolean repeats, Boolean valueTypeOptional, String ns) +960
   System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessors(XmlSchemaGroupBase group, ElementAccessor[] accessors, Boolean repeats, Boolean valueTypeOptional, String ns) +81
   System.Xml.Serialization.XmlSchemaExporter.ExportArrayMapping(ArrayMapping mapping, String ns, XmlSchemaElement element) +394
   System.Xml.Serialization.XmlSchemaExporter.ExportElementMapping(XmlSchemaElement element, Mapping mapping, String ns, Boolean isAny) +41
   System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessor(XmlSchemaGroupBase group, ElementAccessor accessor, Boolean repeats, Boolean valueTypeOptional, String ns) +960
   System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessors(XmlSchemaGroupBase group, ElementAccessor[] accessors, Boolean repeats, Boolean valueTypeOptional, String ns) +81
   System.Xml.Serialization.XmlSchemaExporter.ExportTypeMembers(XmlSchemaComplexType type, MemberMapping[] members, String name, String ns, Boolean hasSimpleContent, Boolean openModel) +316
   System.Xml.Serialization.XmlSchemaExporter.ExportStructMapping(StructMapping mapping, String ns, XmlSchemaElement element) +965
   System.Xml.Serialization.XmlSchemaExporter.ExportElementMapping(XmlSchemaElement element, Mapping mapping, String ns, Boolean isAny) +194
   System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessor(XmlSchemaGroupBase group, ElementAccessor accessor, Boolean repeats, Boolean valueTypeOptional, String ns) +960
   System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessors(XmlSchemaGroupBase group, ElementAccessor[] accessors, Boolean repeats, Boolean valueTypeOptional, String ns) +81
   System.Xml.Serialization.XmlSchemaExporter.ExportTypeMembers(XmlSchemaComplexType type, MemberMapping[] members, String name, String ns, Boolean hasSimpleContent, Boolean openModel) +316
   System.Xml.Serialization.XmlSchemaExporter.ExportMembersMapping(MembersMapping mapping, String ns) +131
   System.Xml.Serialization.XmlSchemaExporter.ExportElementMapping(XmlSchemaElement element, Mapping mapping, String ns, Boolean isAny) +224
   System.Xml.Serialization.XmlSchemaExporter.ExportElement(ElementAccessor accessor) +221
   System.Xml.Serialization.XmlSchemaExporter.ExportMembersMapping(XmlMembersMapping xmlMembersMapping, Boolean exportEnclosingType) +101
   System.Web.Services.Description.SoapProtocolReflector.CreateLiteralMessage(Message message, MessageBinding messageBinding, XmlMembersMapping members, Boolean wrapped, Boolean rpc) +515
   System.Web.Services.Description.SoapProtocolReflector.CreateMessage(Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, Message message, MessageBinding messageBinding, XmlMembersMapping members) +103
   System.Web.Services.Description.SoapProtocolReflector.ReflectMethod() +441
   System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding) +1776
   System.Web.Services.Description.ProtocolReflector.Reflect() +641
   System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors) +685
   System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url) +118
   System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri, Boolean excludeSchemeHostPortFromCachingKey) +230
   System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() +434
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +122

[InvalidOperationException: Unable to handle request.]
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +320
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +171

[InvalidOperationException: Failed to handle request.]
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +374
   System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +209
   System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +66
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +308
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1073.0 



Please help me to solve this problem as i am not getting any solution.

What I have tried:

When i will remove any EmguCV related code, then it will work fine.
But it is necessary for me to use EmguCV code in web service.
Posted
Updated 3-Aug-16 22:10pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900