ASP.NET页上的MS SQL超时,但SSMS中没有 [英] MS SQL Timeout on ASP.NET Page but not in SSMS

查看:85
本文介绍了ASP.NET页上的MS SQL超时,但SSMS中没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的ASP.NET页之一上执行sproc时,它在SQL Server上超时,但超时已过期。在操作完成之前超时或服务器没有响应。。当我在SSMS中执行相同的sproc时,它会相对快速地返回。 SQL Server和IIS在同一框中。我在两个地方都以同一用户身份登录。其他页面也很好。

When a sproc is executed on one of our ASP.NET pages, it times out on the SQL Server with the exception Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. When I execute the same sproc in SSMS, it returns relatively quickly. The SQL Server and IIS are on the same box. I logged in as the same user in both places. Other pages are just fine.

推荐答案

可能是参数嗅探。

在这里我的答案为您提供了一些查询,您可以使用它们检索两个执行计划(SSMS和ASP.NET)以进行比较和对比。

My answer here gives you some queries that you can use to retrieve both execution plans (the SSMS one and the ASP.NET one) to compare and contrast.

编辑

实际上这可能是一个更有用的查询。

This might be a more useful query actually.

Use YourDatabase;

SELECT *
FROM sys.dm_exec_cached_plans 
CROSS APPLY sys.dm_exec_sql_text(plan_handle) 
CROSS APPLY sys.dm_exec_query_plan(plan_handle) 
cross APPLY sys.dm_exec_plan_attributes(plan_handle) AS epa
where sys.dm_exec_sql_text.OBJECTID=object_id('YourProcName') 
         and attribute='set_options'

这篇关于ASP.NET页上的MS SQL超时,但SSMS中没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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