Search code examples
c#asp.net.netnpgsql

The ContinuousProcessing parameter is no longer supported.NPGSQL


I just upgraded my npgsql from 2.5.5 to 3.1.1 and i am getting this runtime error.

My DbConnection class

 public static string ServerConnectionString()
    {
        var connectionStringBuilder = new NpgsqlConnectionStringBuilder
        {
            Host = ConfigurationManager.AppSettings["Server"],
            Username = ConfigurationManager.AppSettings["UserId"],
            Database = "postgres",
            Password = ConfigurationManager.AppSettings["Password"],
            CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeout"]),
            ApplicationName = EverestEnums.ConnectionApplicationName.EverestServerChecker.ToString(),
            //  MaxPoolSize = 200,
            //   SyncNotification = true,
            KeepAlive = 1,
            ConnectionLifeTime = 1,
          //  MinPoolSize = 1,
            Pooling = false
        };
        return connectionStringBuilder.ConnectionString;
    }

Stack Trace

[NotSupportedException: The ContinuousProcessing parameter is no longer supported. Please see http://www.npgsql.org/doc/3.1/migration.html]

Npgsql.NpgsqlConnectionStringBuilder.set_ConnectionLifeTime(Int32 value) +62 Everest.Net.DatabaseLayer.DBFactory.DbConnection.ServerConnectionString() in E:\Everest_PES\Everest.Net.DatabaseLayer\DBFactory\DBConnection.cs:13 Everest.Net.DatabaseLayer.DBFactory.DBOperations.IsServerAvailable() in E:\Everest_PES\Everest.Net.DatabaseLayer\DBFactory\DBOperations.cs:216 Everest.Net.DatabaseLayer.DBFactory.ServerConnectivity.IsDbServerAvailable() in E:\Everest_PES\Everest.Net.DatabaseLayer\DBFactory\ServerConnectivity.cs:7 Everest.Net.BusinessLayer.DBFactory.ServerConnectivity.IsDbServerAvailable() in E:\Everest_PES\Everest.Net.BusinessLayer\DBFactory\ServerConnectivity.cs:12 Everest.Net.Web.Global.Application_Start(Object sender, EventArgs e) in E:\Everest_PES\Everest.Net.Web\Global.asax.cs:15

[HttpException (0x80004005): The ContinuousProcessing parameter is no longer supported. Please see http://www.npgsql.org/doc/3.1/migration.html] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): The ContinuousProcessing parameter is no longer supported. Please see http://www.npgsql.org/doc/3.1/migration.html] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712

As it was working fine before.But there was some issue with connection pooling.And then i upgraded npgsql and this rumtime error.Any Help.


Solution

  • It looks like that exception is thrown when you get or set the ConnectionLifeTime property on the NpgsqlConnectionStringBuilder. The property is obsolete and replaced by the Connection Idle Lifetime property now (see http://www.npgsql.org/doc/migration.html). Try to use this instead:

     public static string ServerConnectionString()
        {
            var connectionStringBuilder = new NpgsqlConnectionStringBuilder
            {
                Host = ConfigurationManager.AppSettings["Server"],
                Username = ConfigurationManager.AppSettings["UserId"],
                Database = "postgres",
                Password = ConfigurationManager.AppSettings["Password"],
                CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeout"]),
                ApplicationName = EverestEnums.ConnectionApplicationName.EverestServerChecker.ToString(),
                //  MaxPoolSize = 200,
                //   SyncNotification = true,
                KeepAlive = 1,
                ConnectionIdleLifetime = 1,
              //  MinPoolSize = 1,
                Pooling = false
            };
            return connectionStringBuilder.ConnectionString;
        }