CFrontDotNet throws an error when used in a web service site

KarlRhodesKarlRhodes Member Posts: 37
I am writing a number of web services using C# in VS2010 that use CFrontDotNet to communicate with a Nav 5.0 database.

I am also writing a Winforms application as a test platform which is being developed in parallel on the same machine as my web services solution.

If I run a method that connects to Navision on my winforms app, it works fine. If I cut and paste the same function into my web services app and declare it as a web method, then try to run it, I get an error.

I've tried 2 methods of accessing CFrontDotNet such as the code blocks shown here...
CFrontDotNet cfront = new CFrontDotNet();
or
CFrontDotNet.Instance...
... and the error I get is shown here...

The Navision CFront initialization failed, with following error: . Please verify that CFront.dll/CFrontsql.dll are available and located in the directory where the application is started.

I have also tried making sure the 2 dlls mentioned are in the build folder, but thats made no difference.

Why is it a winforms application can use CFrontDotNet, but a web services application running on the same pc, with the same code can't? The web services are running in debug mode from Visual Studio and haven't been setup in IIS yet.

Comments

  • ara3nara3n Member Posts: 9,256
    I suggest to do exe upgrade and use webservices. Cfront is gone in the next version.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • KarlRhodesKarlRhodes Member Posts: 37
    Not an option I'm afraid.

    The reason for the web services is to expose a small section of the application and an upgrade is far too costly.

    I just need to know why I get the error and how to get around it.
  • ara3nara3n Member Posts: 9,256
    Not a full upgrade. Just executable. You just open the db with newer version...
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • KarlRhodesKarlRhodes Member Posts: 37
    I found this link and have tried their suggestion of copying the cfrontand cfrontsql dlls to my test web server environments etc but Im not having any joy.

    Surely I must be able to use CFrontDotNet in a web environment using IIS? ](*,)
  • KarlRhodesKarlRhodes Member Posts: 37
    I decided to try to deploy to a test web server to see if it was just my development environment that was complaining.

    Unfortunately it wasn't. I started to get ASP.Net errors in my web service pages which suggested the DLLs referenced in my application were bad. After a short search around I found a webpage that talked about 32bit com objects and 64 bit environments, and after changing my application pool to enable 32 bit applications to run in a 64 bit process (in advanced settings of the application pool) I started to get the error described in my original post. Still not working, but at least the web service was replicating what I had in my development environment.

    I thought then that this might have something to do with the user running the web service site, so I changed this to be my own credentials, but this made no difference.
  • KarlRhodesKarlRhodes Member Posts: 37
    Got it...

    When a site starts in your development environment, a new process loads which can be identitfied in Task Manager. Right click the process and then on "Open File Location". This is the location that the Cfront.dll and cfrontsql.dll should be put.

    With IIS, then you need to set the application pool for your app to enable32 bit applications in a 64 bit environment.

    You also need to start your site, and in the same way the process showed up for the development environment, a w3wp*32.exe will show up. Copy the dlls to here.

    Dont forget that your application also needs to be built against the x86 processor.
Sign In or Register to comment.