При использовании emgucv в ASP.NET веб-служба, ошибка приходит без параметрического конструктора, определенного для этого объекта
Я использую ASP.NET веб-служба, вызываемая из настольного приложения.
Все будет хорошо, пока я не добавил Emugu CV (Dot net wrapper of OpenCv) в код веб-сервиса.
Даже нет проблем с использованием пространства имен EmguCV. Но, проблема начинается тогда, когда я включу, EigenObjectRecognizer и его объекты в код.
Вот код;
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; } }
Вот в чем ошибка:
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
Пожалуйста, помогите мне решить эту проблему, так как я не получаю никакого решения.
Что я уже пробовал:
Когда я удалю любой код, связанный с EmguCV, тогда он будет работать нормально.
Но мне необходимо использовать код EmguCV в веб-сервисе.