Home Help Center

How to Install icepatch2server as Windows Service In C# Winforms?

zhourong_bjzhourong_bj Member zhou rongOrganization: travelskyProject: autoupdate for newapp
Dear Zeroc Staff,
I try to install icepatch2server.exe as WinNT Service with the following code:
1 AssemblyInstaller installer = new AssemblyInstaller();
2 string[] options = new string[0];
3 installer.UseNewContext = true;
4 installer.Path = @C:\Ice-3.3.0\bin\icepatch2server.exe;
5 installer.CommandLine = options;
6 IDictionary saveState = new Hashtable();
7 installer.Install(saveState);
8 installer.Commit(saveState);
when debug to line4, it throws the following exception:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Ice-3.3.0\bin\icepatch2server.exe' or one of its dependencies. The module was expected to contain an assembly manifest.
I use depends to view the depend relationship of icepatch2server.exe,found mpr.dll no bind.
Have you ever encountered this kind of problem and have some solutions or have other method to solve it? Thanks in advance.

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Rong,

    The icepatch2server.exe is a regular unmanaged C++program -- it doesn't contain any System.Configuration.Install Installer class.

    We describe how to install IcePatch2 as a Windows Service in the Ice manual.

    Best regards,
    Bernard
  • zhourong_bjzhourong_bj Member zhou rongOrganization: travelskyProject: autoupdate for newapp
    sc start Services Error.

    Hi Bernard.
    Tnank for your immediately reply.
    I according to the Ice Manual to succeed creating the icepatch2server.exe as windows service:
    >sc create PatchGUIDE binPath= "C:\Ice-3.3.0\bin\ice
    patch2server.exe --Ice.Config=C:\Ice3.3.0\config\icepatch2.cfg --service PatchGU
    IDE" start= auto obj= "NT Authority\LocalService" password= ""
    the following is: sc qc result:
    SERVICE_NAME: PatchGUIDE
    TYPE : 10 WIN32_OWN_PROCESS
    START_TYPE : 2 AUTO_START
    ERROR_CONTROL : 1 NORMAL
    BINARY_PATH_NAME : C:\Ice-3.3.0\bin\icepatch2server.exe --Ice.Config=C
    :\Ice3.3.0\config\icepatch2.cfg --service PatchGUIDE
    LOAD_ORDER_GROUP :
    TAG : 0
    DISPLAY_NAME : PatchGUIDE
    DEPENDENCIES :
    SERVICE_START_NAME : NT Authority\LocalService
    the Content of is icepatch2.cfg
    IcePatch2.Directory=E:\workspace\source\AppUpdate\src\server\manager\AppUpdateSvrMgr\bin\Debug\NEWAPP\GUIDE\GUIDE_2.7.8411.0_SP5
    IcePatch2.Endpoints=tcp -h 172.17.34.52 -p 10005
    IcePatch2.InstanceName=GUIDE
    the above is three paramters value of cmd "sc start PatchGUIDE"
    But when I execute cmd "sc start PatchGUIDE"
    only to get error:[SC] StartService FAILED 1053:
    I think it may be user authorities , My User account has administrator authority.
    Tnank for your reply!
  • zhourong_bjzhourong_bj Member zhou rongOrganization: travelskyProject: autoupdate for newapp
    Hi Benard,
    Otherwise, I want to know what is differences between "sc create --" and "icepatch2server.exe --install" on install icepatch2server.exe as Window Service ?If I use the latter,whether have some defects? Thanks.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Rong,

    The --install command line option is deprecated: I don't recommend using it.

    For Windows service troubleshooting, please refer to http://www.zeroc.com/doc/Ice-3.3.0/manual/WindowsServices.51.6.html.

    Note that while your user account is an Administrator and can most likely read all IcePatch2-related files and directories, this may not be true for the configured service account (NT Authority\LocalService). If this LocalService account can't read the exe, DLL, config file, or IcePatch2 directory, the service won't start.

    Cheers,
    Bernard
  • zhourong_bjzhourong_bj Member zhou rongOrganization: travelskyProject: autoupdate for newapp
    Can not start Patch Service that create with SC under Ice-3.1.1

    Hi Bernard:
    For some reason, We have to use Ice-3.1.1. But According to your above Thread,I install icepatch2server as Windows Service as follow cmd:
    >sc create PatchGUIDE binPath= "C:\Ice-3.1.1\bin\icepatch2server.exe
    --Ice.Config=C:\Ice-3.1.1\config\icepatch2.cfg --service PatchGUIDE" start= aut
    o obj= "NT Authority\LocalService" password= ""
    [SC] CreateService SUCCESS
    But when I tried to Start this Patch Service,the result is
    D:\test2\CKI>sc start PatchGUIDE
    [SC] StartService FAILED 1053:

    I already execute cacls cmd on config file and its Directory,patch Directory etc. such as >cacls "C:\Program Files\TravelSky\FDC" /G "Local Service":F Adminis.
    Do you know there is anything mismatch between Ice-3.1.1(patch) and SC cmd or something else that I did not think of. Thanks in advance.
    Best Wish!
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Rong,

    The free support on these forums is only for the latest Ice version, currently Ice 3.3.0. If you use our software for a mission critical application, you may want to subscribe to our Priority support; please email us at [email protected] for more information.

    Best regards,
    Bernard
Sign In or Register to comment.