MS SQL内部连接致命错误。错误状态:15设置依赖

时间:2018-04-04 13:12:40

标签: c# sql-server

  

这不是重复的

     

因为我在移植后才会出错(直接复制代码)   从一台服务器到另一台。所以,我知道这段代码一直在努力   很长时间。唯一的变量是VS2015和SQL Server Enterprise。

我的应用程序在运行VS2010和SqlExpress的服务器上完美运行

我已移植到运行VS2015和Microsoft SQL Server Enterprise(64位)的服务器

在新机器上,我一直在ExecuteReader行上遇到这个问题:

这个错误是什么意思?

string sqlCommandText; 
        if (Master.G.AgentHandlesAllExchanges)
        {
            sqlCommandText = "SELECT [Symbol] FROM [" + AccountCode + "].[Orders] WHERE [Status] = 'NEW'";
        }
        else{
            sqlCommandText = "SELECT [Symbol] FROM [" + AccountCode + "].[Orders] WHERE [Exchange] = 'Equity' AND [Status] = 'NEW'";
        }

    if (conn.State != ConnectionState.Open)
    {
        Open();
    }

    using (SqlCommand command = new SqlCommand(sqlCommandText, conn))
    {

        Dependency = new SqlDependency(command);

        Dependency.OnChange += new OnChangeEventHandler(OnDependencyChange);

        using (SqlDataReader reader = command.ExecuteReader())
        {
            // Process the DataReader.
        }
    }
  

System.InvalidOperationException未被用户代码
处理   HResult = -2146233079消息=内部连接致命错误。错误   state:15,Token:1 Source = System.Data StackTrace:          在System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,   BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject   stateObj,布尔& dataReady)          在System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()          在System.Data.SqlClient.SqlDataReader.get_MetaData()          在System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,   RunBehavior runBehavior,String resetOptionsString,Boolean   isInternal,Boolean forDescribeParameterEncryption)          在System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior   cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean   async,Int32超时,任务& task,Boolean asyncWrite,Boolean inRetry,   SqlDataReader ds,Boolean describeParameterEncryptionRequest)          在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior   cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String   方法,TaskCompletionSource`1完成,Int32超时,任务&任务,   布尔和放大器; usedCache,Boolean asyncWrite,Boolean inRetry)          在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior   cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String   方法)          在System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior   行为,字符串方法)          在System.Data.SqlClient.SqlCommand.ExecuteReader()          在C:\ Projects \ CobraPROD \ CobraPROD \ SqlPA.cs中的Cobra.SqlPA.InitialiseDependencyWORK(Action onDependencyMethod):行   251          在C:\ Projects \ CobraPROD \ CobraPROD \ SqlPA.cs中的Cobra.SqlPA.InitialiseDependency(Action onDependencyMethod):第222行          在C:\ Projects \ CobraPROD \ CobraPROD \ Models.cs中的Cobra.modelAgent1.calcSignal(SingleProductData MPD):第2029行          在C:\ Projects \ CobraPROD \ CobraPROD \ Models.cs中的Cobra.modelAgent1.NewOrdersCallBack():第1857行          在Cobra.SqlPA.OnDependencyChange(Object sender,SqlNotificationEventArgs e)中   C:\ Projects \ CobraPROD \ CobraPROD \ SqlPA.cs:第287行          在System.Threading.ExecutionContext.RunInternal(ExecutionContext   executionContext,ContextCallback回调,对象状态,布尔值   preserveSyncCtx)          at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean   preserveSyncCtx)          在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)          在System.Data.SqlClient.SqlDependency.EventContextPair.Invoke(SqlNotificationEventArgs)   参数)          在System.Data.SqlClient.SqlDependency.Invalidate(SqlNotificationType   type,SqlNotificationInfo info,SqlNotificationSource source)          在System.Data.SqlClient.SqlDependencyPerAppDomainDispatcher.InvalidateCommandID(SqlNotification)   sqlNotification)InnerException:

1 个答案:

答案 0 :(得分:0)

看起来像是dotnet错误。

https://referencesource.microsoft.com/#system/net/system/Net/HttpWebRequest.cs

    // For portability only
    public virtual bool AllowReadStreamBuffering {
        get {
            return false;
        }
        set {
            if (value) {
                throw new InvalidOperationException(SR.GetString(SR.NotSupported));
            }
        }
    }