Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableDependency.SqlClient.Exceptions.UserWithNoPermissionException:“User without permissions.” #217

Open
JohnnyZhang0628 opened this issue Oct 26, 2020 · 3 comments

Comments

@JohnnyZhang0628
Copy link

Application: .net core 3.1,
OS:win 10,
VS :2019,
SqlTableDependency:8.5.8
Sql Server :10.50.1600.1.
this is my test code:

internal class Program
    {
        private static string _con = "data source=.; initial catalog=exam; integrated security=True";

        public static void Main()
        {
            using var dep = new SqlTableDependency<TB_VERSION>(_con, "TB_VERSION");
            dep.OnChanged += Changed;
            dep.Start();

            Console.WriteLine("Press a key to exit");
            Console.ReadKey();

            dep.Stop();
        }

        public static void Changed(object sender, RecordChangedEventArgs<TB_VERSION> e)
        {
            var changedEntity = e.Entity;

            Console.WriteLine("DML operation: " + e.ChangeType);
            Console.WriteLine("VERSION_ID: " + changedEntity.VERSION_ID);
            Console.WriteLine("VERSION_NO: " + changedEntity.VERSION_NO);
            Console.WriteLine("VERSION_CONTENT: " + changedEntity.VERSION_CONTENT);
            Console.WriteLine("VERSION_DATE: " + changedEntity.VERSION_DATE);
        }
    }

    public class TB_VERSION
    {
        public int VERSION_ID { get; set; }

        public string VERSION_NO { get; set; }

        public string VERSION_CONTENT { get; set; }

        public DateTime VERSION_DATE { get; set; }
    }

i try to run the following command, it's doesn't work.

ALTER DATABASE exam SET ENABLE_BROKER
ALTER DATABASE exam SET TRUSTWORTHY ON
ALTER AUTHORIZATION ON DATABASE::exam TO sa;

what should i do ?thanks

@christiandelbianco
Copy link
Collaborator

Has your windows users the DB OWNER or ADMIN grants

@JohnnyZhang0628
Copy link
Author

@christiandelbianco Thanks reply.My windows account has administrator role.I run my app in my local computer,it should not has nothing to do with computer permissions

@ejimeoghenefejiro
Copy link

I had the same issue :“User without permissions.” but when I change my connectionString from this "Data Source=.;Initial Catalog=skynetdemo;User Id=sa; Password=pa$$word123; Trusted_Connection=True; MultipleActiveResultSets=true" to this "Data Source=CYB345-SOFT-01;Initial Catalog=skynetdemo;User Id=sa; Password=pa$$word123;" it work fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants