Converting Console App to Windows Service

I'm trying to convert a Console Application to a Windows Service, so I move the code from the Main procedure (in the Console App) to the OnStart event (in the Service).  I set the account property to LocalSystem, put in the correct command line parameters and change the Startup object to the Service (instead of the main).  I compile, install and start the service.  I write to the event log to confirm the service is working properly.  When I click the Test Connection button in SM59 I get the error that the program isn't registered.  When I do this from the Console App everything work fine.
Any thoughts?
Thanks,

Another important point it the command line: You should know that services have two command lines: One written in the registry and passed to the Main function (that is usually hidden in the framework). The other is the one passed to OnStart(). This one is really unusual: You have to type these parameters in the manual start dialog of the Services MMC. So you better don't use is and take your paramters from somewhere else.

Similar Messages

  • Services in SAP management console and related window services and process

    hai
    can u please any one of you can send me the services in SAP management console and related window services(in adminstrator/services) and process in task manager.
    thanks in advance.
    Naga Laxmi

    Hi Naga,
    Please refer to this article for the processes relevant to the Java Instance:
    http://help.sap.com/saphelp_nw04/helpdata/en/62/1bf03eae11e16be10000000a114084/frameset.htm
    Except the processes of the Java instance you can find several processes of the IGS server and the ABAP disp+work processes.
    You can easily find the relevant services by their SAP prefix.
    Hope this helps.
    Best Regards
    Vyara

  • Which solution is better for schedules task? Console application or windows service?

    I have a "MULTI-LEVEL" XML file that I will be getting on daily basis and I want to accomplish following tasks:
    1) I have to read and parse the "MULTI-LEVEL" XML data
    2) Then I have to set or create some kind of .net service (c#) that read the xml and parse the data once a day (daily)?
    3) Now I have SOAP service from other software where I want to feed this XML data to. The schedules service will compare the XML data with software data and update (or add) based on the comparision.
    For this task, I come to conclusion that there are 2 best ways to do this:
    1) Create a console application and use windows task scheduler to run it everyday
    2) Create a windows service that runs in the background
    Which is a better way (or reliable)  solution to do this task? Please advise

    There are several things to keep in mind when writing an app that is designed to run without a user logged in. One of the most common mistakes is requiring some sort of user input.  Since the task will run without user intervention you don't want
    any sort of calls to Console.ReadLine, MessageBox.Show, etc.  They will cause the task to freeze and eventually need to be terminated.  You also don't want to rely on any sort of desktop apps running since a user may or may not be logged on at the
    time.
    Also be aware that a task can be scheduled to run under any user context.  As such you either need to ensure it runs under an account with sufficient privileges or that your app needs no special privileges.  You mentioned you tried to run it from
    bin\debug but you most likely have your project under your Documents directory.  Only you would have permissions to that folder and therefore will run into issues if the task is run under a different context.  You also mentioned you put it in the
    C:\ but users don't have write privileges to that folder and therefore if you tried to write a file out it would fail. If you need to read/write files then you should pick a common location that all users have access to or at least the one that will run the
    scheduled task. Be aware that, by default, Task Scheduler will not run a task elevated. You need to check the option to run elevated when you configure the user to run the task under.
    One of the key things to ensure you do with a task is verify it is working properly as a normal app.  You should also ensure that you have good logging so that if it does fail you can trace down the failure more easily.  One common thing that people
    tend to do in console apps is put a try-catch around the main function and display a message if an unhandled exception occurs. This is going to cause problems in a task.  Simply log the exception and rethrow it so Task Scheduler will flag the run as a
    failure.
    If you still cannot figure out why your task is failing then please add some logging and then tell us what code is being run at the time and what the failure is.

  • Run Adobe AIR app as Windows Service

    I have an app which monitors an RSS feed. Upon an emergency,
    the RSS feed is updated. The app detects the change and launches
    (from the taskbar/dock) full screen, plays an alarm sound and
    displays the message.
    Is it possible to run this app as a service (I know that
    there are several software options to enable this) - my question is
    directed towards launching the full screen warning. Can I utilize
    the windowing API before a user logs in if the app runs as a
    service?
    I have tested this using a couple of those software options
    with no success.
    Does anyone else have any ideas or answers?

    John, did you ever find a solution for running an Adobe AIR app as a Windows Service?

  • AIR app as Windows Service

    Hi!
    I have one question.
    Is it possible to create AIR application which will work like
    Windows Service (start and stop by request from other
    application)?

    I'm not sure if this will work, or even why you'd want to do
    it...
    but there is a program in the Windows server resource kit
    called SRVANY.EXE
    which allows a normal exe to operate as a service
    See
    http://support.microsoft.com/kb/137890

  • How to run Adobe Air App as Windows Service

    I am working on Adobe Air application. Everything about coding and configuration have been good so far but I have some major road blocks down the road:
    1. Schedule my application to run at certain time.
    2. Run the application in the System Tray like a Daemon app
    Does Adobe support for configuring the application to run in System Tray like a Gmail notifier app now? If it does, is it possible for me to have it configure for both Windows and Mac systems?
    If anyone has any pointers or tips, please feel free to let me know. Thanks in advance.

    Last night I got some time to try out your example from "Working with the dock and the system tray"
    It is really impressive to see how easy you can animate the icon on the taskbar, but it doesn't particularly achieve my goal to have a cross-platform taskbar app running.
    I tried to work with Java yesterday and got their Taskbar module working on both platforms. It solves the basic issue. But then I realize Java is missing the Webkits Adobe Air is offering. So I need two Apps in order to achieve the goal to re-use my web app on the desktop. Now I am considering to learn more about the extend feature you mentioned to let the Java application works like a remote control for the Air application's instances.
    So here are some of my current concerns: is it possible to be able to have input from java app into air application's elements? Does Adobe's intergrated runtime support incorporating Java as part of the app like it does with SWF and javascript? Or is there any bridge I can use to have the two applications communicate with one another?

  • Excel Automation with Interop - Windows Service - Microsoft Excel cannot access the file

    I have a windows console application, which automates Excel. In our scenario the application gets called from a Windows Service. If the console app is executed directly everything works fine. If the console app is executed through the Win Service, we get
    the following error when trying to open the excel file:
    Unhandled exception Occured : 'Microsoft Excel cannot access the file 'bla.xls'. There are several possible reasons:
    The file name or path does not exist.
    The file is being used by another program.
    The workbook you are trying to save has the same name as a currently open workbook.'.'
    The code snippet used to open the file:
    xlApp = new Application();xlApp.Visible = false;xlApp.UserControl = false;xlApp.Application.ScreenUpdating = false;xlApp.DisplayAlerts = false;xlWorkbook = xlApp.Workbooks.Open( Filename: filePath,  UpdateLinks: 2,  IgnoreReadOnlyRecommended: true, Editable: false);
    The console app and windows service are running on a Win Server 2008 64-bit OS with Excel 2013 32-bit installed. The service is running with a special user account, which has all the right permissions on accessed files and folders. The excel process is also
    started with the same account (I cheched that one). 
    I already tried to do the following, but to no avail:
    Run excel.exe /automation -> worked fine
    Created the folders and also gave full control to the account under which the service is run (even gave full control to Everyone)
    C:\Windows\SysWOW64\config\systemprofile\Desktop
    C:\Windows\System32\config\systemprofile\Desktop
    Configured DCOM
    Excel Application -> Identity -> Specific user account
    Excel Application -> Identity -> Interactive User
    Excel Application -> Security -> Launch permissions -> Everyone full control
    Several combinations of the above
    So I really am stuck with this problem right now. Any input on this is appreciated.

    I have a windows console application, which automates Excel. In our scenario the application gets called from a Windows Service. If the console app is executed directly everything works fine. If the console app is executed through the Win Service, we get
    the following error when trying to open the excel file
    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office
    may exhibit unstable behavior and/or deadlock when Office is run in this environment.
    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side.
    If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
    You can read more about that in the
    Considerations for server-side Automation of Office article.

  • "Invalid printer specified" for 32bit Windows Service in 64bit Server

    Hi All,
    I'm having some issues with crystal reports.
    My development environment:
    Visual Studio 2008, 32bit Windows XP
    Running environment:
    Windows Server 2003 Service Pack 2 64 bit
    Crystal Reports Basic Runtime for Visual Studio 2008 (x86)
    I've created two applications: one is console application and one is windows service. Both application run same codes to print crystal reports to printers and run at 32 bit. I can have multiple instance of console application running without any issues. When I run the windows service version, the first time the service works fine. But after I restarted the windows server, the crystal report throw Sysstem.Runtime.InteropServices.COMException.
    The detail of the exception is:
    System.Runtime.InteropServices.COMException (0x80000201):
    Invalid printer specified.
       at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ModifyPrinterName(String newVal)
       at CrystalDecisions.CrystalReports.Engine.PrintOptions.set_PrinterName(String value)
       at Company.PrintReport(ReportClass report, String printerName)
    Both console application and windows service run at 32 bits. The user runs the service is domain controller who has admin permission. And the same problem happened on an web application hosted on IIS of the same server.
    What I've done so far:
    1. Set the printer option in the report to no printer
    2. Try install the crystal report x64
    3. For the windows service build for x86.
    Please some one help me in this.
    Cheers

    That is a rather strange issue.
    Make sure you are killing the report object once you're doen with it. E.G;
    Dim report as New ReportDocument
    Protected Sub Page_load()
    End Sub
    Private Page_Unload()
    report.close()
    report.dispose()
    GC.Collect
    End Sub
    //C# (on form open):
    private void WebForm1_Init(object sender, System.EventArgs e)
        if (boReportDocument != null)
            boReportDocument.Close();
            boReportDocument.Dispose();
            GC.Collect();
    // C# on form close
    private void Page_Unload(object sender, EventArgs e)
            if (boReportDocument != null)
            { boReportDocument.Close();
                boReportDocument.Dispose();
                GC.Collect();
    If closing and disposing does not help, is htis happening on your dev computer or after you move that app to another server?

  • Console App - Handling close request.

    I have a console app being called by a service.  It's a job that will run for about 4 hours.
    When it receives a shutdown request from the service, (or task manager, or from someone shutting down the computer) I want to handle this and SAVE my changes, then exit.
    I wrote a AppDomain.CurrentDomain.ProcessExit handler, but it doesn't seem to get called ever.
    I'd rather live with false hope than with false despair.

    Check this thread with the details in the update section:
    http://stackoverflow.com/questions/474679/capture-console-exit-c-sharp
    Also consider changing your console app to windows app or windows service if the above will not suit your case.
    Shutdown in windows service:
    http://stackoverflow.com/questions/5202119/detect-shutdown-in-window-service
    Fouad Roumieh

  • Web Service Client(Console App) not working on Windows Server 2008 R2 Standard Edition

    I am trying to consume an ASMX Web Service in a console app, its working fine in Windows 7,Windows Server 2012 Standard,Windows Server 2008 R2 DataCenter,Windows Server 2008 R2 Enterprise, But its not working in Windows Server 2008 R2 Standard Edition which
    is the deployment server.
    I tried consuming the ASMX web service using Web Reference and Service Reference as well but its not helping. Its throwing up the following error,
    Message:There is an error in XML document (1, 331491).
    Inner Exception : System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 331491.
    The scenario is that i call the web service and it returns me an XML i am not able to receive the XML on Windows Server 2008 R2 Standard Edition.
    Please provide suggestions on this I need to resolve this ASAP.

    Hi,
    This question is better asked here:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=asmxandxml
    Experts here are more familiar about it and they can give you more efficient suggestion.
    Thank you.

  • How to create a client console to connect to server in windows service using c#

    my code is error
    can you check the code please
    client console code
    partial class Program : ServiceBase
            public static void Main(string[] args)
                serverservice ss = new serverservice();
                ss.myserver();
                    TcpClient tcpc = new TcpClient();
                    Console.WriteLine("connecting.......");
                    tcpc.Connect("10.128.1.116", 80);
                    Console.WriteLine("connected........");
                    Console.Write("enter msg to be transimitt");
                    string str = Console.ReadLine();
                    Stream stm = tcpc.GetStream();
                    ASCIIEncoding asc = new ASCIIEncoding();
                    byte[] ba = asc.GetBytes(str);
                    Console.WriteLine("transmitting..........");
                    stm.Write(ba, 0, ba.Length);
                    byte[] bb = new byte[100];
                    int k = stm.Read(bb, 0, 100);
                    for (int i = 0; i < k; i++)
                        Console.Write(Convert.ToChar(bb[i]));
                    tcpc.Close();
                windows service for server code is
      public partial class serverservice : ServiceBase
            public serverservice()
                InitializeComponent();
            protected override void OnStart(string[] args)
                myserver();
               Thread mythread = new Thread(new ThreadStart(myserver));
                 mythread.Start();
            public void myserver()
                char d;
                IPAddress ipad1 = IPAddress.Parse("10.128.1.116");
                TcpListener tcpc = new TcpListener(ipad1, 80);
                tcpc.Start();
               // System.Diagnostics.Process.Start(@"C:\Users\PC\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\webs\webs\clientconsole\clientconsole\bin\Debug\clientconsole.exe");
                Console.WriteLine("server is running at port 80");
                Console.WriteLine("local end point is" + tcpc.LocalEndpoint);
                Console.WriteLine("waiting for connection");
              // var client=new TestExecutionEngine
                Socket s = tcpc.AcceptSocket();
                Console.WriteLine("connection is accepted from" + s.RemoteEndPoint);
                byte[] b = new byte[100];
                int k = s.Receive(b);
                Console.WriteLine("received");
                for (int i = 0; i < k; i++)
                    d = Convert.ToChar(b[i]);
              Console.WriteLine(char.ToUpper(d));
                ASCIIEncoding asc = new ASCIIEncoding();
                s.Send(asc.GetBytes("msg is recveived"));
                Console.WriteLine("\n send aknwldge");
                s.Close();
                tcpc.Stop();
               protected override void OnStop()
                EventLog.WriteEntry("stopped");

    kavya --
    You have erroneously posted this question in a user forum dedicated to questions about Project Online, an enterprise project management application.  I would recommend you repost your question in a user forum that deals with C sharp programming questions. 
    Hope this helps.
    Dale A. Howard [MVP]

  • App Server 8.0, run as a Windows service?

    I am running Sun Java System Application Server 8 (Platform Edition) on Windows XP.
    I want to run the app server as a Windows service.
    How can I do this?
    I looked at Sun's documentation. I could not find any information about using the app server as a Windows service.

    Some details:
    The server is started/stoped by a batch asadmin, which collect some parameters and use a java class to instantiate/stop the server. The server process then forks and will be an independent one. Moreover, the App Server is dependent of Sun Message Queue, another service it will start. This other service is called by an exe that will initiate another java process to implement this service. You end up with three process: the java process of the App Server, an exe which controls the JMS service and another java process for the JMS. The Sun Message Queue can be installed as a Windows Service itself, see the docs. App Server 7 seemed to connect cleanly to a running instance of JMS (started either as service or from console), but App Server 8 seems to require its own. I write this in a hurry and it is still an unsolved problem for me (us?), sorry.

  • [Windows 8.1 Desktop/Surface/Phone] connect client app to synchronization service(s)

    Hello Everybody!
    I have to do some research about:  what is the best way to set up my project, I am new to Azure.
    Situation:
    I need to develop a service(s) and client app(s) that are able to synchronize data with each other: files and database changes. the client app(s) must have the capability  to work online / offline,  offline: when there is no internet connection
    the data has to be stored local on the client device(s) and sync it later when there is active internet connection.
    Client Devices:
    Windows 8.1 (Windows 8.1 PC/Desktop)             
    Windows 8.1 RT (Windows 8.1 Surface tablet)
    Windows Phone 8.1 (Windows 8.1 Smart-phone)
    We prefer to create the clients as a C# Store App Application.
    Service:
    This might become , if technically possible and preferable, a Azure service who main task it is to manage the communication between the server and the clients
    Last days I spend my time doing research about how to get this done right.
    I found several interesting techniques, some of got all the features I needed, and some just a few, but most of them aren't supported on one or more devices.
    Microsoft Synchronization Framework
      Sync Toolkit WinRT / Phone
     Live SDK
    Microsoft Synchronization Framework - got all the features I need but is not supported on Win RT and Phone
    Sync Toolkit WinRT / Phone - Only Database Sync, is got bad documentation and unknown if supported on Desktop
    Live SDK - Libraries to integrate with OneDrive, Only File Sync
    Questions:
    Does Azure support all the devices?
    Is Azure supported in  C# Windows 8.1 Store Apps?
    Is Azure suited to host a service I described?
    Thanks in advanced!

    Hi JelteV,
    Thanks for posting!
    Base on my experience, if you wan to synchronize data with each clients. I suggest you could refer to this solution:
    1.Create a Sql Azure Database or storage account for storing your data 
    2.Create a WCF service (web role or work role ) for communication between Client and Database
    3.Set Up Table Structure (Important). I suggest you could add the deviceID and userID to distinguish the different data source. And add fields such as 'status', 'create time', 'latest update time' and so on.
    For example, you client insert a record into local database and set the 'status' as ‘stay update’ or '1'. When your client connect the database and synchronize the data to server, you could set the 'status' as 'updating' or '2' . After
    synchronization  data, you could change the status as 'updated' or '3'.
    According to this idea, the client CRUD -> change the local state code
    -> Sync data -> change the local state code ->
    synchronization is complete -> change the local state code .If the mobile device need operate the data on the service , it also need to change the server status code to be updated, to be deleted (deleted should
    be treated differently), the next time the client login server automatically checks the "state" as "pending action" and then synchronize the server to the client. So whether it is operating on a local table, or on the side of the direct
    operation of the service, you can ensure that the data is synchronized two tables.
    >>Does Azure support all the devices?
    >>Is Azure supported in  C# Windows 8.1 Store Apps?
    >>Is Azure suited to host a service I described?
    From your question, I think you could create a WCF service host on azure, and call WCF service form different devices. And this method is supported the different device and win8.1 store app.
    Also, please see this thread:
    http://stackoverflow.com/questions/14595738/net-data-synchronization-between-multiple-clients-and-a-central-server
    Hope this helps.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I install a windows service in an app?

    1. If it's not allowed / possible, what else am I supposed to do? The app happens to need a background running process that runs whether the user facing part is shown or not. (it does filesystem indexing)
    2. Also I would rather make the ui part in html, but I guess there is no access to c++/c# from js, so I could offer the c#/c++ stuff as a service but yet again I would need to install a service alongside my app.
    So I do actually need a background running process.

    Windows Store apps cannot install or communicate with Windows Services. If you need a service you will need to write a desktop app instead.
    Windows Store apps can launch background tasks to act in the background, but background tasks still run in the app's context and do not have full access to the file system. They probably aren't reasonable for file system indexing (depending on what exactly
    you mean by file system indexing).
    Windows Store apps in HTML can load Windows Runtime Components written in C++ and C#

  • Console.app doesn't show up (window)

    Hi,
    a week or so after I've upgraded to 10.9.2 my console.app stopped opening any log file and it doesn't show even a (blank) window.
    I checked the activity monitor and it seems to be working.
    I've typed "tail -f /var/log/system.log" in a terminal window and opened the Console and it showed this lines:
            15  Foundation                          0x00007fff87c187ba -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
            16  AppKit                              0x00007fff8da50cf9 -[NSApplication _postDidFinishNotification] + 289
            17  AppKit                              0x00007fff8da50a2c -[NSApplication _sendFinishLaunchingNotification] + 195
            18  AppKit                              0x00007fff8da4931a _DPSNextEvent + 1238
            19  AppKit                              0x00007fff8da48a2b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
            20  AppKit                              0x00007fff8da3cb2c -[NSApplication run] + 553
            21  AppKit                              0x00007fff8da27913 NSApplicationMain + 940
            22  libdyld.dylib                       0x00007fff89b0a5fd start + 1
    After readind some posts I've deleted com.apple.console* from ~/Library/Preferences and /Library/Preferences but no luck.
    Any idea how to solve this issue?

    Not sure if this is a typo in your post but:
    ref="networkmanagementconsole.jnlp"
    should be href= .......
    John

Maybe you are looking for

  • XML data source for grid

    I am using web services to read an XML file that contains a schema.  I am using the input as the data source for a grid.  When the grid is populated it does not appear that the schema is interpreted.  All the decimal values are presented as strings a

  • Hyperlinks Don't Work in Preview/Publish Mode - Correct in Design View

    I am having trouble with hyperlinks. I've deleted existing hyperlinks, then copied and pasted addresses back in but it is still not working. Any idea why this is happening. www.ronbrendle.com/reviews.html To the right of each album the links for amaz

  • New T520 With Dead Pixels

    Hi, I have a new T520 that I have purchased about 30 days ago and it already has some deak pixels on the screen. How can I go about getting these fixed?  Thanks, Josh

  • How to set up Query Logging in OBIEE 11g 11.1.1.6

    Hi all, I couldn't find the option for setting up the query logging for testing and debugging purpose. Could anyone plz help me in this ... Regards, Arun

  • How can i execute quuery

    hi, i am facing problem in executing queries. When i amke form and execute query, it will not executed. i can't understand, right now i don't know the error because i am sitting in my office.. ok faizan khalil