Hello,
First of all I would strongly suggest using a windows service project and not a third party library (from a quick look on github it hasn't been maintained for years).
That being said, I can't reproduce your findings.
Maybe your problem is caused by the service privileges ? Maybe check other types and not Local System ?
-----------------------------------------------------------------------------------------------------------------------------------
internal class Program
{
static void Main(string[] args)
{
ConfigureService.Configure();
}
}
-------------------------------------------------------------------------------------------------------------------------------------
public class MyService
{
XSupport Prg;
public void Start()
{
try
{
XSupport.InitInterop(0, @"C:\Soft2\xdll.dll");
if (Prg == null || Prg.Handle == 0)
Prg = XSupport.Login(@"C:\Soft2\web.xco", "***", "***", 1001, 1000, DateTime.Now);
using (var salDoc = Prg.CreateModule("SALDOC"))
{
using (var finDoc = salDoc.GetTable("FINDOC"))
{
using (var iteLines = salDoc.GetTable("ITELINES"))
{
salDoc.InsertData();
finDoc.Current["SERIES"] = 7002;
finDoc.Current["TRDR"] = 3382;
iteLines.Current.Append();
iteLines.Current["MTRL"] = 149043;
iteLines.Current["QTY1"] = 1d;
salDoc.PostData();
}
}
}
}
catch { }
}
public void Stop()
{
}
}
-----------------------------------------------------------------------------------------------
internal static class ConfigureService
{
internal static void Configure()
{
HostFactory.Run(configure =>
{
configure.Service<MyService>(service =>
{
service.ConstructUsing(s => new MyService());
service.WhenStarted(s => s.Start());
service.WhenStopped(s => s.Stop());
});
configure.RunAsLocalSystem();
configure.StartManually();
configure.EnableShutdown();
configure.SetServiceName("TestService");
configure.SetDisplayName("TestService");
});
}
}
Best regards,
Zeikos Christos
--