Git Product home page Git Product logo

Comments (14)

umarsolehri avatar umarsolehri commented on May 23, 2024 1

thank you for your cooperation
I also searched a lot and my issue solved by just small changing in connection string
<add name="DefaultConnection" connectionString="Data Source=serverName;Initial Catalog=KCMSDb;User Id = username ; Password = password;Integrated Security=True" providerName="System.Data.SqlClient" />

to

<add name="DefaultConnection" connectionString="Data Source=serverName;Initial Catalog=KCMSDb;User Id = username ; Password = password;" providerName="System.Data.SqlClient" />

or in simple by just removing "Integrated Security=True" from my connection string

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

Hi. Deployment is done using a backup database?

from monitor-table-change-with-sqltabledependency.

umarsolehri avatar umarsolehri commented on May 23, 2024

Backup database?

from monitor-table-change-with-sqltabledependency.

umarsolehri avatar umarsolehri commented on May 23, 2024

I created database in sql server in windows server, everything is running fine but not detecting any change

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

Ok. After runnig your application, can you see SqlTableDependency database objects? For example a new trigger on your database table?

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

Also, which sqlserver version are you usung?

from monitor-table-change-with-sqltabledependency.

umarsolehri avatar umarsolehri commented on May 23, 2024

private string ConnectionString { get { return System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; } }
private readonly static Lazy _instance = new Lazy(
() => new CommenHubService(GlobalHost.ConnectionManager.GetHubContext().Clients));

    private static SqlTableDependency<CommentModel> _tableDependency;
    public static CommenHubService Instance { get { try { return _instance.Value; } catch { return null; } } }
    private IHubConnectionContext<dynamic> Clients { get; set; }

    public CommenHubService(IHubConnectionContext<dynamic> clients)
    {
        Clients = clients;

        var mapper = new ModelToTableMapper<CommentModel>();
        mapper.AddMapping(e => e.ContentId, "ContentId");
        mapper.AddMapping(e => e.CommentId, "CommentId");
        mapper.AddMapping(e => e.Comment, "Comment");

        _tableDependency = new SqlTableDependency<CommentModel>(ConnectionString, "Comments", mapper);

        _tableDependency.OnChanged += SqlTableDependency_Changed;

        _tableDependency.Start();
    }

from monitor-table-change-with-sqltabledependency.

umarsolehri avatar umarsolehri commented on May 23, 2024

sql 2014 enterprise

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

ok...your code is fine.
When you run your application on local host, i suppose you are using a different DB.
In this case, can you try to change the connection string of your local application, pointing to deployed DB?

I ask that, because can be that DB you are using was created from a old SQL Server instance (for example 2008). Even if now it is under SQL 2014 enterprise, it conserve settings that make it not compatible with SqlTableDependency.

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

If you run this SQL script on DB (the one used by deployed on IIS 8 windows server)

SELECT DatabaseProperty('the database name', 'version')
GO

what is the result you get?

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

Also, can you run these two scripts?

SELECT name, compatibility_level from sys.databases WHERE name = 'the database name'
GO

SELECT name, version from master.dbo.sysdatabases where name = 'the database name'
GO

from monitor-table-change-with-sqltabledependency.

umarsolehri avatar umarsolehri commented on May 23, 2024

dbimage

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 23, 2024

ok...last thing.
Can you make a backup of your database, removing all tables/stored procedures not involved in SqlTableDependency issue. Drop all record in monitored table. Then...can you send me?
Because i need as scenario to reproduce the issue you are facing. In all my tests I never had someting similar.

from monitor-table-change-with-sqltabledependency.

gandarez avatar gandarez commented on May 23, 2024

It seems to not work with Integrated Authentication

from monitor-table-change-with-sqltabledependency.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.