[fixed] [4378] Issues accessing network share using the service (1 Viewer)

Lehmden

Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,554
    3,936
    Lehmden
    Home Country
    Germany Germany
    HI.
    Today I've had a bit spare time to play with this again. Complete fresh single seat install, no leftovers from previous installations, no MySQL database plugin. But issue is still the same. I can't add Network shares to MP2. I even tried to replace NetworkNeighborhoodResourceProvider plugins (both Server and Client) with the working ones from Winter Release. Can't get it to work. No matter what I've checked in Server settings or any other thing I've done. It's a pity that Mp2 can't use mapped share drives as adding local folders is working normal. I now changed back to Winter release. But I kept SystemStateMenu plugin. It's working flawlessly with Winter Release also...(y)
    Attached are the log files from those experiments...
     

    Attachments

    • Log1.zip
      144.8 KB

    chefkoch

    Retired Team Member
  • Premium Supporter
  • October 5, 2004
    3,129
    1,634
    Dresden / Munich / Maastricht
    Home Country
    Germany Germany
    @Lehmden
    But I really would like to solve you issue with NAS, can we make a remote debugging session this weekend? (btw, my Buffalo Link Station and other Windows PCs are working fine)
    You should take that offer. It might require to spend some time, but it helps to track down such nasty issues. Morpheus was also able to investigate and fix TV issues on Lyfesaver's machines.
    BTW: Are you able to join IRC from time to time?
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,554
    3,936
    Lehmden
    Home Country
    Germany Germany
    Hi.
    @morpheus_xx
    Later tonite I can spend more Time on this. Maybe we can do this debug session then. But now I've got visitors (Formula 1 club)

    Are you able to join IRC from time to time?
    I'm not really used to IRC. Tried to do a Bot- Build last week but did not work. Maybe because I'm using Web-IRC. But I can install a IRC Client if necessary.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    @Lehmden, you also can try to stop the MP2-Server service and then run "MP2-Server.exe -c" to start it in "console mode" (which is the same as it was before we made it a service).

    At least we can see then, if it makes a difference regarding network access.
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,554
    3,936
    Lehmden
    Home Country
    Germany Germany
    if it makes a difference regarding network access.
    It did make a different. Running the server as console I can add Network Shares without any issue. When I restart the Server as service after adding a network share I got an error:
    Ungültiger Pfad.jpg


    If I restart server as console all is well again:
    gültiger Pfad.jpg


    Seems to be a path issue when running server as service.

    Hope this helps a bit.
     

    MJGraf

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

    just out of curiosity: Does your MP2-Server / MP2-Client Computer have the same username with the same Password?
    I'm asking because I think, if this is not the case, this may be the reason why you could see other Computers but not the Shares on These Computers while you are running in Server mode.

    Let me explain how my Setup is currently, maybe that explains also my question.

    Setup:
    1. Laptop (physical Computer). This is where MP2-Server runs - either as Service or as application. There is a user, let's call it "User" with a Password "PW1".
    2. Virtual Machine (VMWare running on the Laptop). This is where MP2-Client runs. There is also a user called "User" (same username as on my Laptop) with the same Password "PW1".
    3. HTPC (physical Computer). There I have two Network Shares with media files. There's also a user called "User" (same username as above), but the Password for that user is different "PW2".
    What I did:

    First i ran the MP2-Server as a Service.
    When I selected (only) "use credentials of interactive session on Server", and then tried to add a (global) share with the NetworkNeighborhoodResourceProvider, it didn't work at all (although, while the Service was running, there was an interactive session on my Laptop - I was logged in as User/PW1). What I got was a Screen with "there was an internal error while configuring the share".
    My conclusion is that "use credentials of interactive session on Server" doesn not work, when MP2-server runs as Service (which would make sense to me because otherwise, a Service would obviously be able to "steal" the credentials and therefore also the rights of a logged in user, which would be a big security Problem....)

    Then I went to Settings / Server Settings / Network Credentials, unchecked "use credentials of interactive session on Server", checked "use username and Password to Access Network" and entered "User"/"PW1". I tried to add a global share with the NetworkNeighborhoodResourceProvider and now I could see the htpc. But when I clicked on the "+" to Show the Shares of that Computer, no Shares are displayed.
    This also makes sense to me because User/PW1 may be allowed to browse the Network on my Laptop, but it may not be allowed to browse the Shares on htpc.

    Finally, i left only "use credentials of interactive session on Server" checked and entered "User"/"PW2". Again, I tried to add a global Share with the NetworkNeighborhoodResourceProvider. The result was that there was no error Shown as with "use credentials of interactive session on Server", but there was no le Computer on my Network listed.
    Again, this makes sense, since User/PW2 may be allowed to browse the shares on my htpc, but this user may not be allowed to browse the Network on my Laptop.

    Then I ran the MP2-Server as application.
    First I only checked "use credentials of interactive session on Server" again. Tried to add a global share again with the NetworkNeighborhoodResourceProvider. It worked like a charm. I could see all the computers in the network and could access all the shares of my htpc.
    I would assume that - in the interactive session on which the server now runs as application - I have beofre starting the MP2-Server already accessed the shares of my htpc. After a reboot, it always asks me once for the credentials, which I then enter and the session seems to cache them somewhere (this is only the case, if the username is identical and the passwords are different. If the username is also different, the credentials are cached "forever", i.e., you don't have to enter them again after a reboot, but this is expected Windows behaviour). Since these credentials are cached in the user session and MP2-Server now uses this session, it can browse the network (using User/PW1) and also browse the shares on htpc (using the cached User/PW2).

    Then I went to Settings / Server Settings / Network Credentials, unchecked "use credentials of interactive session on Server", checked "use username and Password to Access Network" and entered "User"/"PW1". The result is the same as above, I can see the computers, but not the shares on htpc.

    Finally, I tried with "User"/"PW2". The result is that everything works fine.
    Here I have some problems to explain this behaviour. Apparently it uses the "User"/"PW1" credentials to browse the network although i did not check "use credentials of interactive session on Server". But then it uses "User"/"PW2" to access the shares on htpc.

    Conclusion:
    First of all, this explains your error above (which I can confirm after all). You were able to add a share while running as application (either by "use credentials of interactive session on Server", or by "use username and Password to Access Network" with the username and password of your NAS entered in the settings). Then you started the MP2-server as a service and suddenly the server was not able to access the share anymore, which results in the error message as in your picture above (also with the UUID in front of it).

    This means for me that ideally, we would need to be able to enter multiple credentials.
    We need credentials with the right to browse the network on the computer on which MP2-server is running.
    Then we need credentials with the right to browse (and access) the desired network shares.

    Taking this into account, it would imho make sense to have credentials in the NetworkNeighborhoodResourceAccessor. If the accessor points to "/" (root), it needs the credentials, which enable it to browse the network on the MP2-Server. When the accessor points e.g. to "\\htpc" it needs the credentials to access the shares on HTPC. Typically, from this point downward, the credentials should be the same, but to be flexible, why not have the possibility to have other credentials for "\\htpc\Music" than for "\\htpc\Videos". Maybe there are different users with different access rights.

    I haven't attached logs so far because these were MANY logfiles until I got it right... So if you need logs from one of the test above, please, @morpheus_xx, let me know.

    Hope that helps...
    Michael
     
    Last edited:

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,554
    3,936
    Lehmden
    Home Country
    Germany Germany
    Hi.
    Does your MP2-Server / MP2-Client Computer have the same username with the same Password?
    MP2 server and MP2 client are on the same physical machine. The folder I like to add as share is on a different machine. All my computers always have the same user with the same password, no matter which machine it is. So User: "User" and Password: "PW1" is valid on all computers in my network, no matter which computer. BTW this User has Admin rights and it's the only one I've created myself on any of the machines.
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    BTW this User has Admin rights and it's the only one I've created myself on any of the machines.
    That's the same on my machines - just the password on HTPC is different.

    But the rest of your observations is really strange. From my findings above, it should work for you when running as a service if you
    1. Deselect "use credentials of interactive session on Server" in Settings / Server Settings / Network Credentials,
    2. Select only "use username and Password to Access Network" and
    3. Enter your credentials, which are identical on all machines.
    If that doesn't work, I fear we will Need to wait for Morpheus...

    Michael
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Some more things in the code I don't understand - maybe there's something wrong, but I can't tell for sure.

    The credentials are used in NetworkNeighborhoodResourceAccessor.ImpersonateUser().

    This method is only called in
    • IsResource(string path)
    • GetFiles() and
    • GetChildDirectories()
    What I don't understand is, why it's only called in these three methods. What about e.g. in the constructor:
    • NetworkNeighborhoodResourceAccessor(NetworkNeighborhoodResourceProvider parent, string path) - If path is not a serverPath, then we create an instance of ILocalFsResourceAccessor here (e.g. for a sharePath) without impersonating the respective user and assign it as _underlayingResource. Can this work?
    This would not solve my Problem with multiple credentials, but it may help if, as in your case, there is only one user/Password combination on all Computers.

    Michael
     

    Users who are viewing this thread

    Top Bottom