当我尝试在新计算机上迁移旧项目时出现错误。在旧计算机上,数据库工作正常。数据库的内容不重要,这就是为什么我没有把旧数据库作为.bak文件带到新计算机。这是一个学校项目。
我在工作:
VS 2015.
ASP.NET Core
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
这是来自VS PackedManager的错误代码:
System.OverflowException:算术运算导致溢出。在System.Data.SqlClient.SNINativeMethodWrapper.SNIOpenSyncExWrapper(SNI_CLIENT_CONSUMER_INFO& pClientConsumerInfo,IntPtr& ppConn) at System.Data.SqlClient.SNINativeMethodWrapper.SNIOpenSyncEx(ConsumerInfo consumerInfo,String constring,IntPtr& pConn,Byte [] spnBuffer,Byte [] instanceName,Boolean fOverrideCache,Boolean fSync,Int32 timeout,Boolean fParallel) at System.Data.SqlClient.SNIHandle..ctor(ConsumerInfo myInfo,String serverName,Byte [] spnBuffer,Boolean ignoreSniOpenTimeout,Int32 timeout,Byte []& instanceName,Boolean flushCache,Boolean fSync,Boolean fParallel) at System.Data.SqlClient.TdsParserStateObject.CreatePhysicalSNIHandle(String serverName,Boolean ignoreSniOpenTimeout,Int64 timerExpire,Byte []& instanceName,Byte [] spnBuffer,Boolean flushCache,Boolean async,Boolean fParallel) 在System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,SqlInternalConnectionTds connHandler,Boolean ignoreSniOpenTimeout,Int64 timerExpire,Boolean encrypt,Boolean trustServerCert,Boolean integratedSecurity,Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,Boolean ignoreSniOpenTimeout,TimeoutTimer timeout,Boolean withFailover) 在System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,Boolean redirectedUserInstance,SqlConnectionString connectionOptions,TimeoutTimer timeout) 在System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout,SqlConnectionString connectionOptions,Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,SqlConnectionString connectionOptions,Object providerInfo,Boolean redirectedUserInstance,SqlConnectionString userConnectionOptions,SessionData reconnectSessio nData,Boolean applyTransientFaultHandling) 在System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnection,DbConnectionOptions userOptions) 在System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool池,DbConnection owningObject,DbConnectionOptions选项,DbConnectionPoolKey poolKey,DbConnectionOptions userOptions) 在System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection) 在System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection) 在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,UInt32 waitForMultipleObjectsTimeout,Boolean allowCreate,Boolean onlyOneCheckConnection,DbConnectionOptions userOptions,DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal& connection) 在System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1重试) 在System.Data.SqlClient.SqlConnection.Open() 在Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open() 在Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists) 在Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists() 在Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) 在Microsoft.EntityFrameworkCore.Design.MigrationsOperations.UpdateDatabase(String targetMigration,String contextType) 在Microsoft.EntityFrameworkCore.Tools.Cli.DatabaseUpdateCommand。<> c__DisplayClass0_0.b__0() 在Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String [] args) 在Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String [] args) 算术运算导致溢出。
我在网上搜索过解决方案,但没找到我认为可以使用的任何内容。我正在使用SSMS 2016最新版本来处理数据库。
很高兴知道我目前正在学校工作,同一台计算机上的虚拟机。我正在使用VMWare,并且虚拟机上的WAC服务器上安装了SQL Server Express 2012。我不知道这对我当前的问题是否有任何影响,但我知道你知道的越多,你可以提供更好的帮助。在处理此问题时,虚拟机未运行。
告诉我你是否还想要我的代码。
答案 0 :(得分:0)
最终解决了这个问题。我完全重置了Windows 10.并安装了VS 2017.然后一切正常。我还做了一个新的测试项目并尝试迁移它。但同样的问题仍然存在。所以我认为它必须是一些破碎的文件。但如上所述它现在都有效。所有的建议Thanx。