Results 1 to 22 of 22

Thread: [RESOLVED] Could not create Windows user token from the credentials specified

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Resolved [RESOLVED] Could not create Windows user token from the credentials specified

    Hi All,

    I have developed a web service and installed in a server suucess fully, its working fine there.

    I tried to work in another server, But I had some error there in the new server.

    I trying to access a network folder, Its accessible for the user which I have mentioned in the web config, But I'm having error.

    in the web config
    <identity impersonate="true" userName="UserName" password="password"/>

    If you have any idea tel me
    Attached Images Attached Images  

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Could not create Windows user token from the credentials specified

    It should be domain\username

    Code:
    <identity impersonate="true" userName="Domainname\UserName" password="password"/>
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Thanks DanaSekar,

    Yes, Its may be like this, I'm waiting for the client's reply.

    But, I learned something by this
    -------------------------------------------------------------------------
    Error: "Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user... "

    This error usually is encountered when either the username / password is not valid for the selected user OR the selected user does not have necessary privilege.

    You can add the privileges by following the below steps:

    Run - Control Panel, Administrative Tools, Local Security Policy

    Choose - Local Policies, User Rights Assignment from the tree

    "Act as part of OS" should be the second entry on the right hand pane
    -------------------------------------------------------------------------
    Is it right???

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Hi,

    I tried this too

    open C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config

    find: <processModel
    change attributes: userName="machine" password="AutoGenerate"
    where "machine" will be the account name you want to run under, and "AutoGenerate" is the password for that account.

    But but not working.... still having the same problem

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    I would encourage you not to make changes to the machine.config file without good reason, as these changes will go against all the web applications on that server.

    Have you verified that the username and password that you have entered into your web.config file actually working on the server that you are trying to access?

    Gary

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Hi Gary,

    Thanks for the reply.

    The username and password which are given in the web config files is which I used to login into the system, Its belongs to the administrator gruop....

    But the same code working in my machine with a mapped drive, but not in the server.

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    Can you provide some details about how these servers interact with each other? Are they all on the same network? Are they part of the same workgroup/domain?

    Gary

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Gary,

    Its a single web service which is installed locally in a machine.

    The service want to work with a mapped network drive,

    The drive, username, password details are in a .ini file.

    The web service consumes that file and work with that,

    I installed the same service two more machines its working fine.

    But not in this machine... Its the problem.
    Its giving the error.

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    Hey,

    How and where are you mapping this drive, and what permissions have you set up on the destination folder?

    Gary

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Gary,

    I need to get the Text files from this mapped drive to the web service.

    I mapped the drive from my the system, and I need to use the drive with the web service.

    I used the code like this

    Code:
    //WIN32API - WNetAddConnection2
            [DllImport("mpr.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
            private static extern int WNetAddConnection2A(
            [MarshalAs(UnmanagedType.LPArray)]
            NETRESOURCE[] lpNetResource,
            [MarshalAs(UnmanagedType.LPStr)]
            string lpPassword,
            [MarshalAs(UnmanagedType.LPStr)]
            string lpUserName,
            int dwFlags
            );
    
                    NETRESOURCE[] nr = new NETRESOURCE[1];
                    nr[0].lpRemoteName = share;
                    nr[0].lpLocalName = ""; //mLocalName;
                    nr[0].dwType = 1; //disk
                    nr[0].dwDisplayType = 0;
                    nr[0].dwScope = 0;
                    nr[0].dwUsage = 0;
                    nr[0].lpComment = "";
                    nr[0].lpProvider = "";
                    WNetAddConnection2A(nr, password, username, 0);

  11. #11
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Could not create Windows user token from the credentials specified

    Quote Originally Posted by sarathi125 View Post
    Gary,

    I need to get the Text files from this mapped drive to the web service.

    I mapped the drive from my the system, and I need to use the drive with the web service.

    I used the code like this

    Code:
    //WIN32API - WNetAddConnection2
            [DllImport("mpr.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
            private static extern int WNetAddConnection2A(
            [MarshalAs(UnmanagedType.LPArray)]
            NETRESOURCE[] lpNetResource,
            [MarshalAs(UnmanagedType.LPStr)]
            string lpPassword,
            [MarshalAs(UnmanagedType.LPStr)]
            string lpUserName,
            int dwFlags
            );
    
                    NETRESOURCE[] nr = new NETRESOURCE[1];
                    nr[0].lpRemoteName = share;
                    nr[0].lpLocalName = ""; //mLocalName;
                    nr[0].dwType = 1; //disk
                    nr[0].dwDisplayType = 0;
                    nr[0].dwScope = 0;
                    nr[0].dwUsage = 0;
                    nr[0].lpComment = "";
                    nr[0].lpProvider = "";
                    WNetAddConnection2A(nr, password, username, 0);


    Did you try to map the drive from the new service machine manually ?
    Please mark you thread resolved using the Thread Tools as shown

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Dana,
    Thanks for the reply.

    Already teh drive is mapped to the machine manually, we using that only.

    Actually I'm using a username in the identity tag of the web config,
    The user is belongs to adminstrator group,
    Is there anything differrence between the administrator and teh user who belongs from the administrator.

    Because, In one installation the administrator account working fine,

  13. #13
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Could not create Windows user token from the credentials specified

    Try this one..
    Please mark you thread resolved using the Thread Tools as shown

  14. #14
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    This can only be a problem with permissions. There must be something different between the two servers that work, and the one that doesn't. It is hard to know what that is, without more information from you.

    Gary

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Gary,
    What information you looking for

  16. #16
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    Hey,

    What Operating Systems are you using?
    The user that you are trying to use, is it a local user, or it is a domain account?
    Does that user, if it is a local one, have the correct permissions on the shared folder?
    Are the computers on a domain?
    Are the computers on a workgroup?
    etc..

    Bottom line is, this a a permission problem. You have two computers that are working and one that isn't. Look at the differences between them.

    Thanks

    Gary

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Question Re: Could not create Windows user token from the credentials specified

    Gary,

    Thanks for the reply.

    I have solved the problem by analysis the problem with the IIS 5.1.

    For your information
    its a Windows XP machine
    with IIS 5.1

    I have removed teh existing web service and installed the new and changed the
    ASP.NET settings of the webservice property in the IIS 5.1.

    And in the configuration, I have changed the Application with the Impersonate mode checkbox, I unchecked it. And now its working fine.

    So finally its working fine now. But, I need the final conclussion where, what mistake I did, But, I need to set permission for all the folders which are all involving with the web service, Please advice on this.

  18. #18
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    So, to be clear, on the systems where is was working before, what settings did you have in IIS? I am assuming that impersonate mode was off, it was correct?

    In your case, you are providing the user name and password for mapping the drive directly in the code, and likely for accessing the files. With impersonation mode in IIS turned on, it would be using the credentials on the incoming request to try and do this work, however, with your ASP.Net Configuration the way it was, it should have been passing again those credentials from your ASP.Net website.

    So I am still not 100&#37; clear on what/why it is working.

    Bottom line is, what do you want to happen?

    Do you want the credentials of the person accessing your site to determine whether the drive should be mapped? Or, do you want to hard code the credentials, such that the same set of credentials will be used for every person who is accessing your site?

    Gary

  19. #19

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    268

    Thumbs up Re: Could not create Windows user token from the credentials specified

    Gary,

    Thanks for the time spent...

    Its clear now....

  20. #20
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Could not create Windows user token from the credentials specified

    Glad to hear it!

    Gary

  21. #21
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Could not create Windows user token from the credentials specified

    Quote Originally Posted by sarathi125 View Post
    Gary,

    Thanks for the time spent...

    Its clear now....


    Could you Please the actual answer for your problem, so that this will be helpful for others.
    Please mark you thread resolved using the Thread Tools as shown

  22. #22
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Could not create Windows user token from the credentials specified

    Quote Originally Posted by danasegarane View Post
    Could you Please the actual answer for your problem, so that this will be helpful for others.
    Good point Dana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width