Tags: asp, commands, custom, database, error, file, level, line, microsoft, msg, mysql, net, oracle, parse, run, script, server, specific, sql, state, tableprofile, user

Msg 15151, Level 16, State 1, Line 5 (Cannot find the user)

On Database » Microsoft SQL Server

20,697 words with 5 Comments; publish: Wed, 02 Jan 2008 17:12:00 GMT; (250296.88, « »)

I'm getting a specific error when i try to run a .sql script for a Custom TableProfile from the Asp.net site,when i Parse the .sql file Commands execute perfectly. But when i actually "Execute" the .sql script i get the following errors::

Msg 15151, Level 16, State 1, Line 5

Cannot find the user 'WYATT-PC\Wyatt\ASPNET', because it does not exist or you do not have permission.

How can i fix this?

Thxs in Advance Rattlerr

All Comments

Leave a comment...

  • 5 Comments
    • I have a .sql script that will run just fine when i remove the following script lines::

      grant EXECUTE on dbo.aspnet_Applications_CreateApplication to [YOURMACHINENAME\ASPNET]

      grant EXECUTE on dbo.aspnet_Users_CreateUser to [YOURMACHINENAME\ASPNET]

      grant SELECT on dbo.aspnet_Users to [YOURMACHINENAME\ASPNET]

      grant UPDATE on dbo.aspnet_Users(LastActivityDate) to [YOURMACHINENAME\ASPNET]

      go

      I'm using Sql Server 2005 Advanced logging in threw "Windows Authentication", in the Security Folder -> Login Folder Wyatt-PC

      \Wyatt has all the Server Rolls checked ( bulkadmin, dbcreator, diskadmin, processadmin, public, securityadmin, serveradmin, setupadmin & sysadmin). The Login name is: Wyatt-PC\Wyatt..

      I would assume [YOURMACHINENAME] would be the name of my computer which is the same as the Login,so i'm abit confused..Thxs for the help in Advance Rattlerr

      Msg 15151, Level 16, State 1, Line 5

      Cannot find the user 'Wyatt-PC\ASPNET', because it does not exist or you do not have permission.

      #1; Thu, 13 Sep 2007 17:03:00 GMT
    • I don′t know if I get you right, is the WebServer on the same Machine as the SQL Server ? If not the SQL Server does not know about your local accounts.

      Jens K. Suessmeyer.

      http://www.sqlserver2005.de

      #2; Thu, 13 Sep 2007 17:04:00 GMT
    • yeah, the Webserver is on the same machine as the Sql Server itself. I guess i should run a Re Install of the Sql Server to see if it fixes the issue?

      But any suggestions on this problem is greatly appreciated..Thxs in advance Rattlerr

      PS: i even set the Permissions up threw the GUI but the same error continues::

      Right Click The Table or Stored Procedure go too Properties, than Permissions.. Their is where i even selected the Execute for a User Account but still no go..

      Here is the sampleSchema Script that i'm trying to use, I have setup the Permissions mentioned above manully the "Execute,Update, Select,Insert & Delete you see in the Script..

      Code Snippet

      --Set this to the name of your database

      --

      use TableProfileProviders

      go

      --

      --grants on ASP.NET stored procedures and tables used by the custom providers

      --

      grant EXECUTE on dbo.aspnet_Applications_CreateApplication to [YOURMACHINENAME\ASPNET]

      grant EXECUTE on dbo.aspnet_Users_CreateUser to [YOURMACHINENAME\ASPNET]

      grant SELECT on dbo.aspnet_Users to [YOURMACHINENAME\ASPNET]

      grant UPDATE on dbo.aspnet_Users(LastActivityDate) to [YOURMACHINENAME\ASPNET]

      go

      --drop table dbo.ProfileTable_1

      --go

      create table dbo.ProfileTable_1 (

      UserId uniqueidentifier not null Primary Key,

      FirstName nvarchar(50) null,

      LastName nvarchar(50) null,

      Age int null,

      LastUpdatedDate datetime not null)

      go

      grant SELECT,INSERT,UPDATE,DELETE on dbo.ProfileTable_1 to [YOURMACHINENAME\ASPNET]

      go

      --

      --Get stored procedure

      --

      --drop procedure getCustomProfileData

      create procedure getCustomProfileData

      .sqlserver.questionfor.info.ApplicationName nvarchar(256),

      .sqlserver.questionfor.info.UserName nvarchar(256),

      .sqlserver.questionfor.info.FirstName nvarchar(50) OUTPUT,

      .sqlserver.questionfor.info.LastName nvarchar(50) OUTPUT,

      .sqlserver.questionfor.info.Age int OUTPUT

      as

      declare .sqlserver.questionfor.info.ApplicationId uniqueidentifier

      set .sqlserver.questionfor.info.ApplicationId = NULL

      --Get the appid

      exec dbo.aspnet_Applications_CreateApplication .sqlserver.questionfor.info.ApplicationName, .sqlserver.questionfor.info.ApplicationId OUTPUT

      --Return data for the requested user in the application

      select .sqlserver.questionfor.info.FirstName = FirstName,

      .sqlserver.questionfor.info.LastName = LastName,

      .sqlserver.questionfor.info.Age = Age

      from dbo.ProfileTable_1 pt,

      dbo.vw_aspnet_Users u

      where u.ApplicationId = .sqlserver.questionfor.info.ApplicationId

      and u.UserName = .sqlserver.questionfor.info.UserName

      and u.UserId = pt.UserId

      go

      grant EXECUTE on dbo.getCustomProfileData to [YOURMACHINENAME\ASPNET]

      go

      --

      --Set stored procedure

      --

      --drop procedure setCustomProfileData

      create procedure setCustomProfileData

      .sqlserver.questionfor.info.ApplicationName nvarchar(256),

      .sqlserver.questionfor.info.UserName nvarchar(256),

      .sqlserver.questionfor.info.IsUserAnonymous bit,

      .sqlserver.questionfor.info.FirstName nvarchar(50),

      .sqlserver.questionfor.info.LastName nvarchar(50),

      .sqlserver.questionfor.info.Age int

      as

      declare .sqlserver.questionfor.info.ApplicationId uniqueidentifier

      set .sqlserver.questionfor.info.ApplicationId = NULL

      declare .sqlserver.questionfor.info.CurrentUtcDate datetime

      set .sqlserver.questionfor.info.CurrentUtcDate = getutcdate()

      --Get the appid

      exec dbo.aspnet_Applications_CreateApplication .sqlserver.questionfor.info.ApplicationName, .sqlserver.questionfor.info.ApplicationId OUTPUT

      --Create user if needed

      declare .sqlserver.questionfor.info.UserId uniqueidentifier

      select .sqlserver.questionfor.info.UserId = UserId

      from dbo.vw_aspnet_Users

      where ApplicationId = .sqlserver.questionfor.info.ApplicationId

      and LoweredUserName = LOWER(.sqlserver.questionfor.info.UserName)

      if(.sqlserver.questionfor.info.UserId IS NULL)

      exec dbo.aspnet_Users_CreateUser .sqlserver.questionfor.info.ApplicationId, .sqlserver.questionfor.info.UserName, .sqlserver.questionfor.info.IsUserAnonymous, .sqlserver.questionfor.info.CurrentUtcDate, .sqlserver.questionfor.info.UserId OUTPUT

      --Either insert a new row of data, or update a pre-existing row

      if exists (select 1 from dbo.ProfileTable_1 where UserId = .sqlserver.questionfor.info.UserId)

      BEGIN

      update dbo.ProfileTable_1

      set FirstName = .sqlserver.questionfor.info.FirstName,

      LastName = .sqlserver.questionfor.info.LastName,

      Age = .sqlserver.questionfor.info.Age,

      LastUpdatedDate = .sqlserver.questionfor.info.CurrentUtcDate

      where UserId = .sqlserver.questionfor.info.UserId

      END

      else

      BEGIN

      insert dbo.ProfileTable_1 (UserId, FirstName, LastName, Age, LastUpdatedDate)

      values (.sqlserver.questionfor.info.UserId, .sqlserver.questionfor.info.FirstName, .sqlserver.questionfor.info.LastName, .sqlserver.questionfor.info.Age, .sqlserver.questionfor.info.CurrentUtcDate)

      END

      go

      grant EXECUTE on dbo.setCustomProfileData to [YOURMACHINENAME\ASPNET]

      go

      #3; Thu, 13 Sep 2007 17:05:00 GMT
    • And yes the ISS Server is installed i checked to see if it was running and it is..When i went to do a Re Install of Sql Server 2005 Advanced a Warning showed up for the IIS Server. Now i have read people running Vista are having this issue, i looked in my Task manager under Services the following is their and running:

      IISADMIN = IIS Admin Service::

      Description:

      Enables this server to administer metabase FTP services etc etc

      And the IIS server is in the Administrative Panel

      #4; Thu, 13 Sep 2007 17:06:00 GMT
    • Doesn't any have an idea of whats going on here? why the "Grant" statements in the script i posted cause's this error? I mean this is a Sql Server Forum someone has to know something about this
      #5; Thu, 13 Sep 2007 17:07:00 GMT