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
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.的更多相关文章
- The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.
当Insus.NET尝试解决此问题<When using SqlDependency without providing an options value, SqlDependency.Star ...
- how to use boost program options
From: http://www.radmangames.com/programming/how-to-use-boost-program_options If it so happens that ...
- Netty Tutorial Part 1.5: On Channel Handlers and Channel Options [z]
Intro: After some feedback on Part 1, and being prompted by some stackoverflow questions, I want to ...
- How to disable certain HTTP methods (PUT, DELETE, TRACE and OPTIONS) in JBOSS7 .
Resolution Option 1 -Using RewriteValve (can apply globally) You can use RewriteValve to disable the ...
- Enterprise Library深入解析与灵活应用(2): 通过SqlDependency实现Cache和Database的同步
对于一个真正的企业级的应用来说,Caching肯定是一个不得不考虑的因素,合理.有效地利用Caching对于增强应用的Performance(减少对基于Persistent storage的IO操作) ...
- SqlDependency缓存数据库表小案例
SqlDependency的简介: SqlDependency是outputcache网页缓存的一个参数,它的作用是指定缓存失效的数据库依赖项,可以具体到数据库和表. SqlDependency能解决 ...
- SqlDependency不起作用
今天使用SqlDependency,结果不起作用,失效,不管数据库怎么修改,这边都没反应,OnChange事件总是不执行,很奇怪.我打开msdn里的例子,代码复制出来,结果没问题,能执行,那剩下来的问 ...
- sqlDependency监控数据库数据变化,自动通知
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- c# 实时监控数据库 SqlDependency
http://blog.csdn.net/idays021/article/details/49661855 class Program { private static string _connSt ...
随机推荐
- Javascript aop(面向切面编程)之around(环绕)
Aop又叫面向切面编程,其中“通知”是切面的具体实现,分为before(前置通知).after(后置通知).around(环绕通知),用过spring的同学肯定对它非常熟悉,而在js中,AOP是一个被 ...
- 新手的第一个phonegap Android应用
对PhoneGap开发感兴趣的请加入群 PhoneGap App开发 348192525 手机成为现在软件应用必不可少的一种设备,然而手机平台的不统一造成我们需要为不同手机重写代码,这对一般应用来 ...
- 作业二:在github上过程
注册Github
- 使用ACE遇到无法打开包括文件:“inttypes.h”的解决方案
本来想使用ACE_Get_Opt类来做一个命令行解析的功能,但是当项目中配置好了ACE库的路径后,编译时遇到"无法打开包括文件: inttypes.h : No such file or d ...
- FusionCharts简单教程(一)---建立第一个FusionCharts图形
由于项目需求需要做一个报表,选择FusionCharts作为工具使用.由于以前没有接触过报表,网上也没有比较详细的fusionCharts教程,所以决定好好研究FusionCharts,同时做一个比较 ...
- 《OOC》笔记(4)——自动化地将C#代码转化为C代码(结构版)
<OOC>笔记(4)——自动化地将C#代码转化为C代码(结构版) 我在<C表达面向对象语言的机制——C#版>中已经说明了从C#到C的转换方法.这次看<OOC>也是想 ...
- Js~动态判断PC和手机浏览器
这个只是一个小知识,也是在网上找的,挺好用! 动态判断浏览器是PC还是移动端! <script> var browser={ versions:function(){ var u = na ...
- Oracle VM VirtualBox配置文件
Linux 虚拟机配置文件分为两处. windows下: 1.用户名/.VirtualBox/ 这里面有2个配置文件: VirtualBox.xml 和 VirtualBox.xml-prev. 后面 ...
- rewrite规则写法及nginx配置location总结
rewrite只能放在server{},location{},if{}中,并且只能对域名后边的除去传递的参数外的字符串起作用. 例如http://seanlook.com/a/we/index.php ...
- [Java面试十二]数据库概念相关
1. 什么是存储过程?它有什么优点? 答:存储过程是一组予编译的SQL语句,它的优点有: 允许模块化程序设计,就是说只需要创建一次过程,以后在程序中就可以调用该过程任意次. 允许更快执 ...