Sage SDK Web Support

SUGGESTED

Does the Sage 50 SDK support web applications? I'm attempting to create an ASP.NET application to talk with Sage back and forth.

I added the API to the website with it simply starting a session but I receive an expection:

Could not load file or assembly 'Sage.Peachtree.Domain, Version=2017.0.0.70, Culture=neutral, PublicKeyToken=d06c16dde04d83e4' or one of its dependencies. The system cannot find the file specified.

Target framework: .NET Framework 4.5.2
Platform target: x86

My code is as follows

Global.asax.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Sage.Peachtree.API.Resolver;
using Sage.Peachtree.API;

namespace ASPSageAPITest
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            Sage.Peachtree.API.Resolver.AssemblyInitializer.Initialize();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }
}

HomeController.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sage.Peachtree.API.Resolver;
using Sage.Peachtree.API;

namespace ASPSageAPITest.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var apiSession = new PeachtreeSession();

            apiSession.Begin(string.Empty);

            return View();
        }
    }
}

Parents
  • 0
    SUGGESTED
    It is certainly possible to use the .NET SDK with a web application.

    However, in order for this to work, you're going to have to have Sage 50 US installed on the machine that is serving your web pages. That's why you hit an error -- it couldn't find the Sage.Peachtree.Domain.dll, as well as all of the rest of the Sage 50 US dlls.

    Also, the time required to create a session, open the company, perform your operation and close the company might be rather lengthy for a normal web request/response cycle. You are probably better off performing this as a background operation of some kind, perhaps batching several operations together.
Reply
  • 0
    SUGGESTED
    It is certainly possible to use the .NET SDK with a web application.

    However, in order for this to work, you're going to have to have Sage 50 US installed on the machine that is serving your web pages. That's why you hit an error -- it couldn't find the Sage.Peachtree.Domain.dll, as well as all of the rest of the Sage 50 US dlls.

    Also, the time required to create a session, open the company, perform your operation and close the company might be rather lengthy for a normal web request/response cycle. You are probably better off performing this as a background operation of some kind, perhaps batching several operations together.
Children