Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WNetAddConnection2A & Web Services

WNetAddConnection2A & Web Services

Scheduled Pinned Locked Moved C#
wcfhelpquestion
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guinness4Strength
    wrote on last edited by
    #1

    I have a class which wraps the mpr.dll functions that I've used in may applications before. But now I'm attempting to use them in a WebService and the WNetAddConnection2A fails everytime. Any known issue with using these method with Web Services ?

    D 1 Reply Last reply
    0
    • G Guinness4Strength

      I have a class which wraps the mpr.dll functions that I've used in may applications before. But now I'm attempting to use them in a WebService and the WNetAddConnection2A fails everytime. Any known issue with using these method with Web Services ?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Of course it does! The ASPNET account that your webservice runs under, by default, doesn't have permissions to any other network resources. No permissions, no access and the call fails. Either grant the ASPNET account permissions to the network resource you are trying to map to or create a user account that has those permissions and change the account your webservice runs under. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      G 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Of course it does! The ASPNET account that your webservice runs under, by default, doesn't have permissions to any other network resources. No permissions, no access and the call fails. Either grant the ASPNET account permissions to the network resource you are trying to map to or create a user account that has those permissions and change the account your webservice runs under. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        G Offline
        G Offline
        Guinness4Strength
        wrote on last edited by
        #3

        So even though I providing a username and password in the call to WNetAddConnection2A, I need to give permissions in order to even make the call ?

        D 1 Reply Last reply
        0
        • G Guinness4Strength

          So even though I providing a username and password in the call to WNetAddConnection2A, I need to give permissions in order to even make the call ?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Does the account name you're providing have the appropriate rights to the network resource? Are you sure your using the correct name and password? Things can be a bit confusing in a domain environment and different in a workgroup. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          G 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Does the account name you're providing have the appropriate rights to the network resource? Are you sure your using the correct name and password? Things can be a bit confusing in a domain environment and different in a workgroup. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            G Offline
            G Offline
            Guinness4Strength
            wrote on last edited by
            #5

            Yes, the account name I'm providing is the local administrator on that machine. I'm not using any domains at this point. The weird thing is that the function returns immediatly, it seems like there isn't even enough time for the remote machine to accept or reject the call.

            D 1 Reply Last reply
            0
            • G Guinness4Strength

              Yes, the account name I'm providing is the local administrator on that machine. I'm not using any domains at this point. The weird thing is that the function returns immediatly, it seems like there isn't even enough time for the remote machine to accept or reject the call.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Try changing the account that your web service is running under. I get the feeling that the ASPNET account doesn't have any network resource rights to make a connection to anything. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              G 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Try changing the account that your web service is running under. I get the feeling that the ASPNET account doesn't have any network resource rights to make a connection to anything. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                G Offline
                G Offline
                Guinness4Strength
                wrote on last edited by
                #7

                I've already searched online for instructions on how to do this correctly and attempted it, but have been unable to do so. I've changed the ASPNET user password on both machines to the same password and given the account read/write access to the files. But even after I change the password field in the machine.config file the web server will not load the web service. The only way I get it to function properly is to run the aspnet_regiis.exe command to reset the password toa randomly generated one. Have you ever successfully change the ASPNET password ?

                D 1 Reply Last reply
                0
                • G Guinness4Strength

                  I've already searched online for instructions on how to do this correctly and attempted it, but have been unable to do so. I've changed the ASPNET user password on both machines to the same password and given the account read/write access to the files. But even after I change the password field in the machine.config file the web server will not load the web service. The only way I get it to function properly is to run the aspnet_regiis.exe command to reset the password toa randomly generated one. Have you ever successfully change the ASPNET password ?

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  What are you changing the password for???? There's no reason to do it. Create an account that your web service will run under and change it to that account in IIS. On a second thought, why are you mapping a drive inside a web service? This drive mapping will disappear as soon as the current call to the web service returns. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                  G 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    What are you changing the password for???? There's no reason to do it. Create an account that your web service will run under and change it to that account in IIS. On a second thought, why are you mapping a drive inside a web service? This drive mapping will disappear as soon as the current call to the web service returns. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                    G Offline
                    G Offline
                    Guinness4Strength
                    wrote on last edited by
                    #9

                    I guess I thought that all ASP.NET web services and applications ran under the ASPNET account. Where do I change the account at ? I know where to change the anonymous access but that is using IUSR_MACHINE account. I don't see anyplace to change the ASPNET user account. I don't neccessarily have to map a drive, I'm just triing to get access to files on a share on another machine. I have been unable to do so thus far and thought providing a login while mapping a drive would get around the security problems.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups