Quantcast
Channel: Sage 50 US
Viewing all articles
Browse latest Browse all 18012

Forum Post: Problem using Sage API with web app

$
0
0
I'm trying to get an ASP.NET web app to use the Sage 50 2014 API, but am not meeting with much success. As soon as the web app attempts to begin a new Peachtree session, it throws the following exception: Could not load file or assembly 'Sage.Peachtree.Domain, Version=2014.2.1.205, Culture=neutral, PublicKeyToken=d06c16dde04d83e4' or one of its dependencies. The system cannot find the file specified. I already have Sage 50 installed on the server that hosts the web app, and on my dev machine I've added references in Visual Studio to the copies of Sage.Peachtree.API and Sage.Peachtree.API.Resolver created by that installation (in C:\Program Files (x86)\Sage\Peachtree\API on the server). So that means that the paths to these assemblies are network paths in Visual Studio (\\ server name \c$\Program Files (x86)\...), which seems kind of fishy to me, but I'm not sure how else to do it. What's the proper way to reference the Sage API if your dev machine is not the same as the machine that hosts the webapp that actually uses the API? Is that even possible? (Or is this a different issue entirely?) Also, while browsing these forums, I found several suggestions to fix this issue, but none of them worked. Here's a list of what I've tried: Put call to  AssemblyInitializer.Initialize() in  Application_Start  rather than in  Session_Start Did a full (i.e. not server-only) install of Sage 50 on the server that the web app is running on Removed all Sage assemblies from the web app's Bin folder Ensured that IIS is set to run the web app as a 32-bit process (that is, the application pool for the webapp has Enable 32-Bit Applications set to True) Ensured that .NET 4 is the target framework And here are the relevant parts of my code: Global.asax Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)     Sage.Peachtree.API.Resolver.AssemblyInitializer.Initialize() End Sub EditInvoice.aspx.vb Imports Sage.Peachtree.API Partial Class EditInvoice     Inherits System.Web.UI.Page Protected Sub btn_SageInv_Click(sender As Object, e As EventArgs) Handles btn_SageInv.Click     Dim peachtreeSession As New PeachtreeSession()     peachtreeSession.Begin("") ' -- exception thrown here     peachtreeSession.End()     peachtreeSession.Dispose() End Sub End Class Thanks in advance to anyone who can help! UPDATE: We tried adding C:\Program Files (x86)\Sage\Peachtree\API to the system PATH variable on the server and refreshing the application pool, and now instead of the Sage.Peachtree.Domain DLL error, it throws an ArgumentException on the same line of code: Specified directory could not be found Parameter name: p: Here's the Sage-related part of the stack trace:    Sage.Peachtree.DataAccess.PervasiveDTISession.CreateDBName(String dbName, String dictionaryPath) +320    Sage.Peachtree.DataAccess.DatabaseInfoDLO.CreateDatabase(String serverName, String dbNamePrefix, String uncDataPath, IList`1 dbListToSkip) +212    Sage.Peachtree.DataAccess.DatabaseInfoDLO.GetPeachtreeGlobalDbName(String serverName, String dataPath) +303    Sage.Peachtree.Domain.GlobalContext.PreOpen() +38    Sage.SBD.ACS.Framework.BusinessLogic.ContextBase.OpenTemplateMethod() +15    Sage.Peachtree.API.GlobalContext.Open() +30    Sage.Peachtree.API.PeachtreeSession.Begin(String applicationIdentifier) +237 Any advice on how to fix this? Are we heading in the right direction?

Viewing all articles
Browse latest Browse all 18012

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>