Change in sql server location causes Event 1026 .Net Runtime - sql-server

I am connecting an application to a different SQL Server database and find the following error in the windows event log
The only change is the database server
Event 1026, .NET Runtime
Application: My.MyApp2.Win.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
at System.Data.Common.DbConnectionOptions.ConvertValueToBooleanInternal(System.String, System.String)
at System.Data.SqlClient.SqlConnectionString..ctor(System.String)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(System.String, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(System.Data.Common.DbConnectionPoolKey, System.Data.ProviderBase.DbConnectionPoolGroupOptions, System.Data.Common.DbConnectionOptions ByRef)
at System.Data.SqlClient.SqlConnection.ConnectionString_Set(System.Data.Common.DbConnectionPoolKey)
at System.Data.SqlClient.SqlConnection.set_ConnectionString(System.String)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, System.Action`2<System.__Canon,System.__Canon>, System.__Canon, System.Action`3<System.__Canon,System.__Canon,System.__Canon>, System.Action`3<System.__Canon,System.__Canon,System.__Canon>)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionPropertyInterceptionContext`1<System.String>)
at System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(System.String)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at System.Data.Entity.Database.Exists()
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.CheckDatabaseSchemaCompatibilityCore(System.Object)
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.CreateObjectContext(System.Collections.Generic.IList`1<System.IDisposable>)
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.Init(System.Type, DevExpress.ExpressApp.DC.ITypesInfo, DevExpress.ExpressApp.EF.EFTypeInfoSource, System.Data.Common.DbConnection, System.String, System.String, System.String)
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider..ctor(System.Type, System.String)
at My.MyApp2.Shedule.MyApp2Schedule.application_CreateCustomObjectSpaceProvider(System.Object, DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
at System.EventHandler`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Object, System.__Canon)
at DevExpress.ExpressApp.XafApplication.OnCreateCustomObjectSpaceProvider(DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
at DevExpress.ExpressApp.XafApplication.CreateObjectSpaceProviders(System.String)
at DevExpress.ExpressApp.XafApplication.Setup()
at MyApp2.Win.Program.Main()
When I enabled diagnostic actions in XAF I got
Application: My.MyApp2.Win.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.SqlClient.SqlException
at System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1<System.Action>)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject, Boolean, Boolean)
at System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(System.String, Boolean, Int32, Boolean)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(System.Threading.Tasks.TaskCompletionSource`1<System.Object>, System.String, Boolean, Int32, Boolean ByRef, Boolean, Boolean)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, System.Func`3<System.__Canon,System.__Canon,Int32>, System.__Canon, System.Action`3<System.__Canon,System.__Canon,System.__Canon>, System.Action`3<System.__Canon,System.__Canon,System.__Canon>)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext)
at System.Data.Entity.SqlServer.SqlProviderServices+<>c__DisplayClass52_0.<CreateDatabaseFromScript>b__0(System.Data.Common.DbConnection)
at System.Data.Entity.SqlServer.SqlProviderServices+<>c__DisplayClass60_0.<UsingConnection>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy+<>c__DisplayClass2_0.<Execute>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<System.__Canon>)
at System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(System.Data.Common.DbConnection, System.Action`1<System.Data.Common.DbConnection>)
at System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(System.Nullable`1<Int32>, System.Data.Common.DbConnection, System.String)
at System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection, System.Nullable`1<Int32>, System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)
at System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(System.Data.Common.DbConnection)
at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(System.Action)
at System.Data.Entity.Migrations.DbMigrator.Update(System.String)
at System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(System.Data.Entity.Internal.InternalContext, System.Func`3<System.Data.Entity.Migrations.DbMigrationsConfiguration,System.Data.Entity.DbContext,System.Data.Entity.Migrations.Infrastructure.MigratorBase>, System.Data.Entity.Core.Objects.ObjectContext)
at System.Data.Entity.Database.Create(System.Data.Entity.Internal.DatabaseExistenceState)
at System.Data.Entity.CreateDatabaseIfNotExists`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InitializeDatabase(System.__Canon)
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(System.Action)
at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
at System.Data.Entity.Internal.RetryAction`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].PerformAction(System.__Canon)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(System.Action`1<System.Data.Entity.Internal.InternalContext>)
at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.CreateObjectContext(System.Collections.Generic.IList`1<System.IDisposable>)
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.Init(System.Type, DevExpress.ExpressApp.DC.ITypesInfo, DevExpress.ExpressApp.EF.EFTypeInfoSource, System.Data.Common.DbConnection, System.String, System.String, System.String)
at DevExpress.ExpressApp.EF.EFObjectSpaceProvider..ctor(System.Type, System.String)
at My.MyApp2.Shedule.MyApp2Schedule.application_CreateCustomObjectSpaceProvider(System.Object, DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
at System.EventHandler`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Object, System.__Canon)
at DevExpress.ExpressApp.XafApplication.OnCreateCustomObjectSpaceProvider(DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
at DevExpress.ExpressApp.XafApplication.CreateObjectSpaceProviders(System.String)
at DevExpress.ExpressApp.XafApplication.Setup()
at MyApp2.Win.Program.Main()
The connection string is read from connections.config:
<connectionStrings>
<add name="ConnectionString"
connectionString="Server=MYSERVER;Database=MYDATABASE;Integrated Security=false;MultipleActiveResultSets=True;user=myuser;pwd=mypassword;"
providerName="System.Data.SqlClient" />
</connectionStrings>
The working server was running
Microsoft SQL Server 2017 (RTM-CU16) (KB4508218) - 14.0.3223.3 (X64) Jul 12 2019 17:43:08
Copyright (C) 2017 Microsoft Corporation
Express Edition (64-bit) on Linux (Ubuntu 16.04.6 LTS)
The new server is running
Microsoft SQL Server 2019 (RTM-CU2) (KB4536075) - 15.0.4013.40 (X64) Feb 3 2020 16:40:57
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Linux (CentOS Linux 8 (Core))
I can connect to the new server with SSMS
The Winforms program has been developed using the Dev Express XAF framework.
App.config has
<connectionStrings configSource="connections.config" />
Target framework is .NET Framework 4.7.2
I tried removing Integrated Security=false; from the connection string and it made no difference.
I tried using an invalid user name and I did get an error as expected then.
The program simply stops running without any error message.
I see the XAF loading icon but the XAF login screen does not appear.
eXpressAppFramework.log has
11.04.20 19:21:04.119 ================================================================================
11.04.20 19:21:04.135 Trace Log for My.MyApp2.Win.exe is started
11.04.20 19:21:04.135 ================================================================================
11.04.20 19:21:04.135 System Environment
OS Version: Microsoft Windows NT 6.2.9200.0
.Net Framework Versions: v4.0.30319
CLR Version: 4.0.30319.42000
eXpressApp Version: 19.1.8.0
eXpressApp File Version: 19.1.8.0
Application config
Modules=
NewVersionServer=
EnableDiagnosticActions=True
ClientSettingsProvider.ServiceUri=
11.04.20 19:21:04.197 Initialize application
=======================
11.04.20 19:21:04.197 Command line arguments:
C:\MyMyApp2\My.MyApp2.Win.exe
11.04.20 19:21:04.354 The ValueManagerType is initialized by the default value: SimpleValueManager.
11.04.20 19:21:04.369 Stack trace:
at DevExpress.Persistent.Base.ValueManager.CreateValueManager[ValueType](String key)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at DevExpress.Persistent.Base.ValueManager.GetValueManager[ValueType](String key)
at DevExpress.ExpressApp.ReportsV2.ApplicationReportObjectSpaceProvider.set_ContextApplication(XafApplication value)
at DevExpress.ExpressApp.ReportsV2.ReportsModuleV2.Setup(XafApplication application)
at DevExpress.ExpressApp.ModuleList.OnInsert(Int32 index, Object value)
at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
at MyApp2.Win.MyApp2WindowsFormsApplication.InitializeComponent() in D:\dev\SBD.MyMyApp2\MyApp2.Win\WinApplication.Designer.cs:line 78
at MyApp2.Win.MyApp2WindowsFormsApplication..ctor() in D:\dev\SBD.MyMyApp2\MyApp2.Win\WinApplication.cs:line 48
at MyApp2.Win.Program.Main() in D:\dev\SBD.MyMyApp2\MyApp2.Win\Program.cs:line 30

I think the issue is that I have two dbcontexts in the application and the database for one is missing. I will be able to test this tomorrow.

Related

Signature is invalid when executing Unbind in AssertionConsumerService

I implement a SAML service provider that is integrated with the Danish Unilogin IDP. I follow the example: https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2/tree/master/test/TestWebAppCore
When the AssertionConsumerService is executed (in the Unilogin test environment) I get the following exception:
ITfoxtec.Identity.Saml2.Cryptography.InvalidSignatureException:
at ITfoxtec.Identity.Saml2.Saml2Request.ValidateXmlSignature (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at ITfoxtec.Identity.Saml2.Saml2Request.Read (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at ITfoxtec.Identity.Saml2.Saml2Response.Read (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at ITfoxtec.Identity.Saml2.Saml2AuthnResponse.Read (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at ITfoxtec.Identity.Saml2.Saml2PostBinding.Read (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at ITfoxtec.Identity.Saml2.Saml2PostBinding.UnbindInternal (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at ITfoxtec.Identity.Saml2.Saml2Binding`1.Unbind (ITfoxtec.Identity.Saml2, Version=4.8.0.0, Culture=neutral, PublicKeyToken=2dd6b1fbf7645f92)
at Nebb.IdentityServer.Web.Controllers.AuthController+d__5.MoveNext (Nebb.IdentityServer.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: /src/source/Nebb.IdentityServer.Web/Controllers/AuthController.cs:72)
I use the following parameters:
CertificateValidationMode = none
RevocationMode = NoCheck
IdPMetadataFile = https://viden.stil.dk/download/attachments/65503525/et-broker-IdP-metadata.xml?version=7&modificationDate=1578661325000&api=v2
I have connected the ITfoxtec Identity SAML 2.0 component to the Danish Unilogin IdP with success.
Are you configuring the component by loading the Unilogin IdP metadata or doing the configuration yourself?
Is the response encrypted and the saml2Configuration.DecryptionCertificate not configured?
Configured like this:
https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2/blob/master/test/TestWebAppCoreNemLogin3Sp/Startup.cs#L34

This program is blocked by group policy. in godaddy windows hosting

I am trying to execute a .exe file through Scheduled Tasks in Godaddy but when this task is run there is an error of
"This program is blocked by group policy".
Application is a C# console application.
In the web.config, comment out everything within <system.codedom>. GoDaddy blocks it.
<!--<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
</compilers>-->

SSMS 2016 crashes in Edit Top X Rows for Windows 10

I'm having a problem where SSMS will crash while trying to scroll through the results of the "Edit Top X Rows". I have tried reducing the number of rows returned, installing older versions of SSMS, and making sure I am on the latest versions. I will include the event log, as well as the version information for SSMS.
OS is Windows 10 x64
SSMS Info:
download location: https://msdn.microsoft.com/en-us/library/mt238290.aspx
Microsoft SQL Server Management Studio - 13.0.16000.28
Microsoft Analysis Services Client Tools - 13.0.1700.441
Microsoft Data Access Components (MDAC) - 10.0.14393.0
Microsoft MSXML - 3.0 6.0
Microsoft Internet Explorer - 9.11.14393.0
Microsoft .NET Framework - 4.0.30319.42000
Operating System - 6.3.14393
Event Log 1
Faulting application name: Ssms.exe, version: 2015.130.16000.28, time stamp: 0x580af2c5
Faulting module name: KERNELBASE.dll, version: 10.0.14393.321, time stamp: 0x57f4c291
Exception code: 0xe0434352
Fault offset: 0x000da6f2
Faulting process id: 0x3364
Faulting application start time: 0x01d24a529cd4afa4
Faulting application path: C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: c6e3afb2-b3d0-4857-8eb6-e538c1b22ff2
Event Log 2
Application: Ssms.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
at System.Buffer.BlockCopy(System.Array, Int32, System.Array, Int32, Int32)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.FileStreamReader.ReadArray[[System.Char, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](Int64, Boolean, Int32, Microsoft.SqlServer.Management.DataTools.UI.QueryResult.SpecialDataType ByRef, Char[] ByRef, Int32 ByRef)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.FileStreamReader.ReadString(Int64, Boolean, Microsoft.SqlServer.Management.DataTools.UI.QueryResult.SpecialDataType ByRef, System.String ByRef)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.DiskStorageView.SequentialReadColumn(Int32, Boolean)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.DiskStorageView.GetCellDataFromFileInternal(Int64, Int32, Boolean)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.DiskStorageView.GetCellData(Int64, Int32)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.StorageViewBase.GetCellDataAsStringInternal(Int64, Int32)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.DiskStorageView.GetCellDataAsString(Int64, Int32)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.ResultBindingList.GetValue(Int32, Int32)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.QueryResultControl.DataGridView_CellValueNeeded(System.Object, System.Windows.Forms.DataGridViewCellValueEventArgs)
at System.Windows.Forms.DataGridView.OnCellValueNeeded(System.Windows.Forms.DataGridViewCellValueEventArgs)
at System.Windows.Forms.DataGridView.OnCellValueNeeded(Int32, Int32)
at System.Windows.Forms.DataGridViewCell.GetValue(Int32)
at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(System.Drawing.Graphics, System.Windows.Forms.DataGridViewCellStyle, Int32, System.Drawing.Size)
at System.Windows.Forms.DataGridViewCell.GetPreferredWidth(Int32, Int32)
at System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32)
at System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(System.Windows.Forms.DataGridViewCellMouseEventArgs)
at System.Windows.Forms.DataGridView.OnCellMouseMove(System.Windows.Forms.DataGridViewCellMouseEventArgs)
at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo, System.Windows.Forms.MouseEventArgs)
at System.Windows.Forms.DataGridView.OnMouseMove(System.Windows.Forms.MouseEventArgs)
at System.Windows.Forms.Control.WmMouseMove(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.DataGridView.WndProc(System.Windows.Forms.Message ByRef)
at Microsoft.SqlServer.Management.DataTools.UI.QueryResult.DTDataGridView.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)

Entity Framework on SQL Server CE without driver install

I'm developing a WPF application using Entity Framework 4 and SQL Server CE database 3.5 and it's correctly working.
However I'd like to have this application to run on a machine with .Net Framework 4 installed but without the SQL Server Compact 3.5 drivers. And no installer. Is it possible?
I have tried the following:
create a section in the app.config
<configuration>
<connectionStrings>
<add name="DbEntities"
connectionString="metadata=res://*/Model.Model1.csdl|res://*/Model.Model1.ssdl|res://*/Model.Model1.msl;provider=System.Data.SqlServerCe.3.5;provider connection string="Data Source=|DataDirectory|\Data\Database1.sdf""
providerName="System.Data.EntityClient"/>
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="SQL Server Compact Edition Data Provider"
invariant="System.Data.SqlServerCe"
description=".NET Framework Data Provider for Microsoft SQL Server Compact Edition"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
</configuration>
add references to System.Data.SqlServerCe and System.Data.SqlServerCe.Entity and allow local copy
build the application and copy it on a machine without SQL Server CE drivers installed. When it comes to create the data context I keep getting this error :
System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. --->
System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Am I losing time? Or should I just switch to SQLite?
Thanks!
EDIT:
Thanks to josemiguel.torres' answer, I check at this post detailling how to achieve this. However, I still have an assembly error.
"System.IO.FileLoadException: Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)"
So I had a look at this other post explaining how to fix this issue.
After adding some assembly binding:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
It still doesn't work ... :|
Error message is similar :
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
I'm out of solution. Anyone?
EDIT 2:
1.I have uninstalled all the Microsoft "SQL Server Compact Edition" versions from my machine.
2.I checked the machine.config version : there is no entries in the DbProviderFactories section.
3.I downloaded the 3.5 SP2 drivers from there and installed the x86 package.
4.I check my machine.config (v4 x86) and the following entries has been created under the DbProviderFactories node:
<add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
Why is it 3.5.0.0 and not 3.5.1.50???
juste in case: my dev machine is on Win7 x64 and target machine is WinXP x86.
Install 3.5 SP2, and modify the app.config as follows:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ChinookEntities" connectionString="metadata=res://*/Chinook.csdl|res://*/Chinook.ssdl|res://*/Chinook.msl;provider=System.Data.SqlServerCe.3.5;provider connection string="Data Source=C:\Users\erik.COMMENTOR\Documents\Visual Studio 2010\Projects\SqlCeTest\Chinook.sdf"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5" />
<add name="Microsoft SQL Server Compact Data Provider 3.5" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xmlns="">
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Make sure to use the System.Data.SqlServerCe.dll and System.Data.SqlServerCe.Entity.dll from the C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Private folder
I gave up with SQL CE 3.5 and switched to 4.0. It's working fine, thanks to this article.
Thanks Erik ;)

Create assembly from System.Web in SQL Server

Hi I have following problem:
I need to create an assembly in SQL Server database from system.web.dll with following script:
CREATE ASSEMBLY SystemWeb
FROM 'C:\WINDOWS\MICROSOFT.NET\FRAMEWORK\V2.0.50727\SYSTEM.WEB.DLL'
WITH PERMISSION_SET = UNSAFE
At fist cannot create because I retrieve some error because don't find some dependencies dll.
I start to install first the dependencies like system.drawing.dll an so on without problem but when I'm trying to install system.web.dll it require System.EnterpriseServices.dll that require System.Runtime.Remoting.dll that require System.Web and here I'm inside a circle and cannot go OUT.
Somebody can help to resolve it?
Windows Server 2008 / SQL Server 2008 Enterprise
Thank you a lot in advance
SQL Server 2008 CLR only supports a limited list of assemblies out of the box (see this document here for details) - and system.web is not part of that list.
If you need to deploy something else, like system.web then you need to do so with the CREATE ASSEMBLY call.
Here's was a [step-by-step explanation on how to do it] - for system.web, by the way.
The key statement in that article is:
CREATE ASSEMBLY SystemWeb
from 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'
with permission_set = unsafe
Since all the dependent assemblies are
in the same directory, SQL Server
would automatically register them.
Hope this helps!
These are the assemblies you need to deploy, but do you really want to do this?
system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.
system.drawing, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.directoryservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.directoryservices.protocols, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.enterpriseservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.
system.runtime.remoting, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.
system.runtime.serialization.formatters.soap, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.design, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.windows.forms, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.
accessibility, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.drawing.design, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.web.regularexpressions, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.serviceprocess, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.configuration.install, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.

Resources