为什么SQL 2008 Profiler指出从EF4运行的存储过程是在Master? [英] Why does SQL 2008 Profiler indicate that Stored Procedure run from EF4 is in Master?

查看:222
本文介绍了为什么SQL 2008 Profiler指出从EF4运行的存储过程是在Master?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用实体框架4与存储过程和SQL Server 2008 SP1 ...运行SQL Server Profiler(TSQL_SPs模板)时,显示我的存储过程调用和其语句的行表示发生在DatabaseID = 1(Master)但实际上是在我的应用程序数据库中发生的。程序执行正常并返回数据,它们只存在于我的应用程序数据库中,所以为什么Profiler将这些行标记为Master?这是Profiler中的错误?



请注意,对SQL 2000实例运行相同的代码,Profiler正确显示应用程序的数据库ID。



更新 :我现在已经在新安装的SQL Server 2008 R2上进行了测试,并且仍然显示为在Master中发生的情况。 / p>

更新2 :这已被记录到Connect at https://connect.microsoft.com/SQLServer/feedback/details/ 572246 / profiler-reports-ef4-queries-as-occurred-in-master

解决方案

包含你的连接字符串选项'MultipleActiveResultSets = True'?如果是,请尝试删除它并查看sql profiler。


Using Entity Framework 4 with stored procedures and SQL Server 2008 SP1... When running SQL Server Profiler (TSQL_SPs template), the lines that show my stored procedure call and its statements say that this happened in DatabaseID = 1 (Master) but it is actually happening in my application database. The procedures execute properly and return the data, and they only exist in my application database, so why does Profiler mark those lines as being in Master? Is this a bug in Profiler?

Note that running the same code against a SQL 2000 instance, Profiler correctly shows the application's database ID.

UPDATE: I have now tested this on a new installation of SQL Server 2008 R2 and it still displays this as if it happened in Master.

UPDATE 2: This has been logged to Connect at https://connect.microsoft.com/SQLServer/feedback/details/572246/profiler-reports-ef4-queries-as-occurring-in-master.

解决方案

Contains youir connectionstring the option 'MultipleActiveResultSets=True'? If yes, try to remove it and look at sql profiler.

这篇关于为什么SQL 2008 Profiler指出从EF4运行的存储过程是在Master?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆