c# - 无法设置 ADOMDConnection 类的超时属性

标签 c# olap-cube connection-timeout ssas-2008 adomd.net

我正在使用 AdomdConnection 连接类连接到多维数据集。我正在使用以下代码。

 using (var conn = new AdomdConnection(ConnString))
        {
            conn.Open();
            var cube = conn.Cubes[name];
            //Do something
            conn.Close();
        }

AdomdConnection.ConnectionTimeout Property does not have setter property.

connectionTimeOut 属性的默认值为 0,这会将时间设置为无限。

我有两个问题:

  1. 有什么方法可以设置 AdomdConnection 的超时属性吗?
  2. 当多维数据集繁忙并且您尝试运行程序时,在创建连接后打开连接(conn.open())时,系统不会退出此语句并且永远不会执行下一行代码。在这种情况下,应用程序变得不负责任并且不会抛出异常。我如何通知用户此类情况并创建日志条目。

我调查了this similar tread但没有发现它有用。

谢谢

最佳答案

文档对此进行了说明 AdomdConnection.ConnectionTimeout

Gets the time to wait for a connection to be established before the AdomdConnection stops trying to connect and generates an error.

这意味着与服务器通信超时。

如果您希望在运行实际命令时超时,请使用 AdomdCommand.CommandTimeout 属性。

Gets or sets the time to wait for a command to run before the AdomdCommand stops trying to run the command and generates an error.

两者都可以通过连接字符串进行设置。

http://msdn.microsoft.com/en-us/library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring.aspx

关于c# - 无法设置 ADOMDConnection 类的超时属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21158477/

相关文章:

sql-server - 无法执行请求的操作,因为链接服务器 'MSOLAP' 的 OLE DB 提供程序 'SSAS' 不支持所需的接口(interface)

c# - 将 GUI 与微 Controller 连接

c# - 在 Asp.net MVC 和 Entity Framework 中分页时如何应用过滤器?

sql-server - 当属性值重复时 SSAS 处理失败(实际上没问题)

ssas - 在 MDX 中创建具有描述的成员

asp.net - 如何调查 ASP.net 应用程序上的 SQL Server 超时错误?

svn - 在 svnsync 中处理大文件

php - fsockopen() 无法在特定网络主机上运行?

c# - 具有不同参数类型的web api多个post方法

c# - 如何确定 WCF 服务已准备就绪?