在过去的两年中,我们一直在使用 ASP.NET MVC 3、NHibernate (v. 3.3.1.4000) 和用于后端数据库的 PostgreSql 开发基于 Web 的应用程序,因此使用 Npgsql 驱动程序 (v. 2.0.12.0)。该系统已在 4 个不同的客户端服务器上成功利用,并且从未出现我在我们最近设置的新服务器上遇到的错误。该异常仅在最初填充数据时发生过一次,并阻止某些业务实体存储到数据库中。我真的必须确保将来正确处理错误,如果根本不可能避免,但不知如何。一般在网站和互联网上搜索此错误或类似错误并没有产生任何信息。你们有没有人遇到过这个问题或知道如何解决它?谢谢 :)
这是错误:
System.NotSupportedException: This stream does not support seek operations.
at System.Net.Sockets.NetworkStream.Seek(Int64 offset, SeekOrigin origin)
at System.IO.BufferedStream.FlushRead()
at System.IO.BufferedStream.WriteByte(Byte value)
at Npgsql.NpgsqlSync.WriteToStream(Stream outputStream)
at Npgsql.NpgsqlReadyState.SyncEnum(NpgsqlConnector context)
at Npgsql.NpgsqlState.Sync(NpgsqlConnector context)
at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject()
at Npgsql.ForwardsOnlyDataReader.GetNextRowDescription()
at Npgsql.ForwardsOnlyDataReader.NextResult()
at Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable`1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean synchOnReadError)
at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()