System.IO.FileLoadException with WebService

0

I'm using Visual Studio 2013 and I am trying to create a webservice using the assembly DNSTools from Nuance SDK. My WebMethod is really simple : I just create an object from a DNSTools' class, then return "Hello World".

using DNSTools;
namespace WebTestFinal
{
    public class WebServiceTestFinal : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            DgnDictCustom dgn = new DgnDictCustom();
            return "Hello World";
        } 

However when I reach the line :

DgnDictCustom dgn = new DgnDictCustom();

It throws me this error :

System.IO.FileLoadException: Retrieving the COM class factory for component with CLSID {A0E850E3-91DB-11D1-96DC-0080C72FD13C} failed due to the following error: 8007045a. A dll initialization routine failed. (Exception of HRESULT : 0x8007045A).
 at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
 at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
 at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
 at System.Activator.CreateInstance(Type type, Boolean nonPublic)
 at System.Activator.CreateInstance(Type type)
 at WebTestFinal.WebServiceTestFinal.HelloWorld()

I did some research and found out that System.IO.FileLoadException was thrown because an assembly cannot be loaded. Despite using Fuslogvw.exe and Process Monitor I can't find which assembly is the root of the problem.

c#
.net
web-services
asmx
assemblies
asked on Stack Overflow May 28, 2015 by Antoine Delia • edited May 28, 2015 by John Saunders

1 Answer

0

Go to Project Properties and in Build Tab, select X86 for platform target, and if it's already X86 change de to 64

In VS - project properties - in the Build tab - platform target =X86

answered on Stack Overflow May 28, 2015 by Hicham Sadiki

User contributions licensed under CC BY-SA 3.0