First observations with MP2-Server as a service (1 Viewer)

MJGraf

Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    I just tried MP2-Server as a service for the first time and just wanted to post my first observations:

    First of all, for me as an old-school guy it was new that you can't use regsvr32 for .net-services. I didn't build a full installer but just compiled the dev branch. As a result, I had to use "installutil.exe" to get the service installed. The location of this utility, however, was not in my path variable and it took me some time to find it in C:\Windows\Microsoft.NET\Framework\v4.0.30319. Maybe this should be documented for .net-newbies like me :p

    Second observation was that when I started the service from the taskmanager, it started and then it terminated immediately without any error message. There was also no single line in the log files and no error log at all. The windows system log just showed "service terminated". When I started the service in applications mode ("-c" commandline parameter), it started without problems. The reason for the service terminating immediately was that I still had a lot of settings and files in C:\ProgramData\Team MediaPortal\MP2-Server from my old installations, which the MP2-server apparently didn't like (although I don't understand, why MP2-Server started as an application without problems).
    After deleting this directory completely, the service started without problems. While having old files in this directory may be a valid reason for the service terminating, it would be helpful if there was some kind of hint in the logfiles why there is a problem for the service.

    Lastly, my MP2-client did not connect automatically to the MP2-server, when it was started as service. The same MP2-Server as service seems to be recognized as a "different MP2-server" than the same server started as an application. After detaching from the MP2-server and re-attaching again, it worked.

    Besides these observations, very good progress guys! I hope I will have some more time to test in a couple of weeks...

    cheers,
    Michael
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Thanks for this report.

    First of all, for me as an old-school guy it was new that you can't use regsvr32 for .net-services. I didn't build a full installer but just compiled the dev branch. As a result, I had to use "installutil.exe" to get the service installed. The location of this utility, however, was not in my path variable and it took me some time to find it in C:\Windows\Microsoft.NET\Framework\v4.0.30319. Maybe this should be documented for .net-newbies like me

    The installation of service is done by the installer, but if you do it manually the way you went is the only one.

    Second observation was that when I started the service from the taskmanager, it started and then it terminated immediately without any error message. There was also no single line in the log files and no error log at all. The windows system log just showed "service terminated". When I started the service in applications mode ("-c" commandline parameter), it started without problems. The reason for the service terminating immediately was that I still had a lot of settings and files in C:\ProgramData\Team MediaPortal\MP2-Server from my old installations, which the MP2-server apparently didn't like (although I don't understand, why MP2-Server started as an application without problems).

    This one is strange, I have no explanation for this. If we can reproduce it we can fix it I think.

    Lastly, my MP2-client did not connect automatically to the MP2-server, when it was started as service. The same MP2-Server as service seems to be recognized as a "different MP2-server" than the same server started as an application. After detaching from the MP2-server and re-attaching again, it worked.
    This is ok: the server DB was deleted with your action. When MP2-Server recreates it, the server gets a new Guid as Server-ID. As the client settings were not deleted, it still knows the old ID. And in attached state it doesn't look for new servers.
     
    Last edited:

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Thanks for the clarification, Morpheus!
    As to the second issue, I was able to reproduce it. Steps to reproduce:

    1. Delete the Folder C:\ProgramData\Team MediaPortal\MP2-Server
    2. Start MP2-Server as an application (in my case logged in as local Administrator); result is that all the files and Folders in C:\ProgramData\Team MediaPortal\MP2-Server are created.
    3. Stop MP2-Server application
    4. Start MP2-Server as Service

    ==> Service does not start and there is absolutely nothing in any log.

    Solution:
    1. Delete the Folder C:\ProgramData\Team MediaPortal\MP2-Server
    2. Start MP2-Server as Service

    To me it Looks like an Access right Problem. I assume that the Service may be allowed to create files and Folders in C:\ProgramData\Team MediaPortal\MP2-Server and afterward modify These files and Folders if they were created by the Service. The above behaviour can be explained if this was not the case if the files and Folders were created by a user (in this case local admin). This would also explain why there is nothing in the logs (no Access right to the already present log file).

    Let me know if you Need any further tests.

    Michael
     
    Last edited:

    hafblade

    Portal Pro
    January 19, 2011
    675
    290
    Trier, Germany
    Home Country
    Germany Germany
    The installation of service is done by the installer, but if you do it manually the way you went is the only one.

    Hi Morpheus,

    I also wanted to try out the server as a service functionality.
    To do this I got the current repositories dev branch and compiled the client, server and monitor.
    But now I don't know how to create the suiting setup. I checked the wiki but I think I'm to blind to find it.
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Hi hafblade,
    maybe I can help. After you have compiled the Server, open a command prompt, go to this directory
    C:\Windows\Microsoft.NET\Framework\v4.0.30319
    and enter the following:
    installutil.exe [Path to your MP2-Server.exe]\MP2-Server.exe
    Now your new MP2-Server is registered as a Service.
    Then open your Taskmanager and on the Services pane you should find the new MP2-Server.
    Right-click it and select "start Service".
    If it doesn't start, delete the following Directory: C:\ProgramData\Team MediaPortal\MP2-Server
    and try to start it again.
    I haven't tested the Monitor, yet, but I would guess you best add it to your autostart Folder.
    Hope that helps,
    Michael
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,553
    3,934
    Lehmden
    Home Country
    Germany Germany
    Hi.
    I've downloaded complete prebuild Dev Branch installer from team resources so for me the installation did work as expected. The Server did start normal and I got to manage an update from Winter Release also.This update was a bit tricky as the new installation adds SQLCE Database plugin without looking if MySQL Database Plugin is there. And two of them are not possible. That's why my first update attempt did not work.

    But I've got other issues, maybe someone else can confirm. When I use MP2 Server as Service I can't add neither use network shares only local ones. As soon as I start the server as console this is working again like in previous versions.
     
    Last edited:

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Hi Lehmnden,

    I assume that you are using the "local file System resource Provider" to Access the Network share, which you previously mapped as a Network drive. In this case, I can confirm your issue, but this is - at least to my understanding - "expected behaviour". The Service is running in a different user context and mapped Network drives are always limited to a specific user context. As a result, the Network drive, which you mapped under your personal user account, does just not exist for the user account under which the Service is running. As soon as you start MP2-server as an application, it runs under the same user account, for which you have mapped the Network drive and, hence, this Network drive is visible again.
    I don't know under what account the Service runs. Maybe as a preliminary workaraound you could map the Network drive also for the user account under which the Service is running but I'm not sure if this is possible for a Service account.

    The clean solution to my understanding, however, would be to use the "Network neighbourhood resource Provider" instead of the "local file System resource Provider". However, I just tried it (never did that before because my Shares are always local on the MP2-Server) and it doesn't seem to work for me (neither when run as a Service nor as application). I can't see any other Computer in the neighbourhood although These other Computers are visible in the Windows Network neighbourhood. Will try to investigate this in the next few days and post proper logs in a separate thread.

    Michael
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,553
    3,934
    Lehmden
    Home Country
    Germany Germany
    Hi.
    I assume that you are using the "local file System resource Provider" to Access the Network share, which you previously mapped as a Network drive
    No, Mapped Drives didn't even shown if using Local Filesystem Provider. I've tried it with "NetworkResourceProvider" (or simiular, I'm atm not on my HTPC, so I can't have a look how it is called exactly).
    If I use Server as Service I've got "illegal path" (////Spock/D/Serien1/) but if I use Server as Console the path is correct (\\Spock\D\Serien1\)
    You can see it on screenshots in this post:
    https://forum.team-mediaportal.com/...ld-04-11-2013-21-52.118333/page-2#post-986887
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    ok, understood (sorry, missed the other post...)
    But maybe your Problem is then related to mine. Just started to debug a Little bit. My Problem is in
    NetworkResourcesEnumerator.EnumerateResources(NetResource pRsrc, ResourceScope scope, ResourceType type, ResourceUsage usage, ResourceDisplayType displayType)
    When it is trying to parse "Microsoft Windows Network", an error code 1208 is given back, which is why it doesn't Show any resources under the Microsoft Windows Network.
    This, however, for me happens in Service mode as well as in application mode. I'm therefore not sure if your Problem has the same cause as mine, but will try to dig a Little deeper in the next few days...
    Michael
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Jeeeezzzz, sometimes it's really hard to find the cause of a problem...

    @Lehmden: Your Problem is not related to mine, but I'll try to reproduce yours and will Report back in your other thread.

    My Problem is probably a very rare one but I wanted to document it here anyway in case someone else runs into it. It's not a bug in MP2, but a strange behaviour of VMWare...

    My development machine is a virtual VMWare machine - and this is the cause of the Problem.
    As described above, when EnumerateResources tried to enumerate the resources in "Microsoft Windows Network", the return code was 1208, which means "Extended error".
    I added some additional code to call WNetGetLastError and the result there is error code 6118, which means "list of servers for this workgroup is not currently available."
    So far so bad... When I open the Network Neighborhood of Windows, it Shows me all other Computers in my Network. But when I open a command prompt and enter "net view", I get exactly the same error 6118.
    My conclusion is therefore, this is not an MP2 Problem, but a VMWare Problem. Unfortunately I wasn't able to solve it...

    What I did is start the Server on a physical machine and only run the Client in my virtual machine - and suddenly it worked...
    So if someone should have a solution to my VMWare Problem, I'm happy to try ;)

    A last remark regarding the necessary Settings for this to work:
    I was a Little confusing to me to find the credentials-settings in Settings/Server Settings/Network Credentials
    For me it would make more sense to either move the Homeserver Settings from General/Connectivitiy to Server Settings (which would be best imo) or vice versa.
    Finally, it would be good if there was a warning if someone tries to add a global share without having entered any credentials. Took me 10 min to figure out that this is missing... :p

    cheers,
    Michael
     

    Users who are viewing this thread

    Top Bottom