zoukankan      html  css  js  c++  java
  • When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.

    在调试SignalR程序时,提示一个异常:When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.

    解决方法是在Global.asax.cs文件中Application_Start()和Application_End()方法中添加下面高亮代码:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using System.Web.Routing;
    using Insus.NET.DataBases;
    using System.Data.SqlClient;
    
    namespace Insus.NET
    {
        public class MvcApplication : System.Web.HttpApplication
        {
            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
                RouteConfig.RegisterRoutes(RouteTable.Routes);
    
                SqlDependency.Start(DB.ConnectionString);
            }
    
            protected void Application_End()
            {
                SqlDependency.Stop(DB.ConnectionString);
            }
        }
    }
    Source Code
  • 相关阅读:
    触发事件trigger
    淘宝天猫关键词SEO优化
    Linux下升级python
    python3多线程趣味详解
    python之selenium
    1kkk
    python之lxml(xpath)
    python中时间日期格式化符号
    唯品会数据采集-异步瀑布流
    python数据库操作pymysql
  • 原文地址:https://www.cnblogs.com/insus/p/5622792.html
Copyright © 2011-2022 走看看