TableDependency.SqlClient.Exceptions.UserWithNoPermissionException:“User without permissions.”
JohnnyZhang0628 opened this issue · 3 comments
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
Has your windows users the DB OWNER or ADMIN grants
@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
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