大网数据广告活动
数据库与应用安全

Timeout issues when you deploy SQL CLR objects

· 52CE 我爱测

This article provides resolutions for the timeout issues that occur when deploying SQL CLR objects through Visual Studio.

This article helps you resolve the timeout problem that occurs when deploying SQL Common Language Runtime (CLR) objects through Visual Studio.

Original product version:   SQL Server
Original KB number:   2011805

Symptoms

When you deploy SQL CLR objects from Visual Studio to SQL Server, you may experience various errors similar to the following:

  • Error message 1:

    Error: starting database upload transaction failed.
    Error: The operation could not be completed

  • Error message 2:

    Deploying file: TEstAssembly.dll, Path: E:\cases\CL MY\TEstAssembly\TEstAssembly\obj\Debug\TEstAssembly.dll ... Error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

But if you deploy the same CLR objects using CREATE ASSEMBLY command in SQL Server Management Studio you don't experience any issues.

Cause

The issue occurs when the SQL CLR objects are so large that it takes a long time to deploy them to SQL Server. The default timeout value for connections is 15 seconds and for queries is 30 seconds respectively. When deploying large assemblies, the CREATE ASSEMBLY statement that gets executed on the SQL Server backend may take more than 30 seconds to return resulting in the error described in the Symptoms section.

Resolution

Increase the Query timeout and Connection timeout values in Visual Studio using the following procedures.

Changing the Query Timeout

  1. In Visual Studio IDE, navigate to Tools -> Options -> Database Tools -> Query and View Designers.

  2. You can either uncheck the option Cancel long running query or change the value of the Cancel after option **** to a higher value.

Changing the Connection Timeout

  1. In Visual Studio IDE, enable Server Explorer by navigating to View -> Server Explorer.

  2. In the Server Explorer, right click on the connection to SQL Server where the CLR objects are being deployed and select Modify Connection.

  3. Select the Advanced button in the Modify Connection window.

  4. In the Advanced Properties window, change the Connect Timeout value under the Initialization section to a higher value.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 01/20/2021
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。