Entity Framework with EntityDataSource throws MetadataException when installed on Windows 2008 server - entity-framework

I have a problem with installing a Web Application on a server which is using an EntityDataSource and the .NET Framework June CTP.
I posted the question on the MSDN Forums but still have no answer:
EF with POCO templates and DbContext throws MetadataException when installed on server
The following Exception is throwed when installing the application on a windows 2008 server with IIS 7 and when using an EntityDataSource in combination with the June CTP Framework which we need for using POCO and the DbContext.
System.Web.HttpUnhandledException (0x80004005): Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.Data.MetadataException: Schema specified is not valid. Errors:
Library.csdl(2,9) : warning 0005: Could not find schema information
for the attribute 'Namespace'. Library.csdl(2,34) : warning 0005:
Could not find schema information for the attribute 'Alias'.
Library.csdl(2,2) : error 0010: The element Schema in namespace
http://schemas.microsoft.com/ado/2009/11/edm was unexpected for the
root element. The expected Schema in one of the following namespaces:
http://schemas.microsoft.com/ado/2006/04/edm,
http://schemas.microsoft.com/ado/2007/05/edm,
http://schemas.microsoft.com/ado/2008/09/edm. at
System.Data.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable1
xmlReaders, IEnumerable1 sourceFilePaths, SchemaDataModelOption
dataModelOption, DbProviderManifest providerManifest, ItemCollection
itemCollection, Boolean throwOnError)
When we create a test project without the June CTP Framework it is working. When we do not use the EntityDataSource with the June CTP Framework it works too. We developed some months with this EntityDataSource so it's not easy to change the code and use something else.

Your server appears to have .NET 3.5 SP 1, and the CTP requires .NET 4. The schemata in the error message (2006-8) are EF 10 2009/11/edm are EF 4.

Related

Upgrade to EF Core 7 get Microsoft.Data.Sqlite.SqliteException: 'SQLite Error 1: ''.'

I upgrade Ef core 6 to 7 and get this error at Database.EnsureCreated();
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
Database.EnsureCreated();
if (Database.GetPendingMigrations().Any())
{
Database.Migrate();
}
}
The database is created but I get this error. I fear if some migrations are ended with an error and are not complete. and I want these codes always be here and not commented after first run. What is this error and how to correct it?
Edits:
I deleted all content of the Migrations folder and the Sqlite Db and created an Initial migration, But when I want to apply this migration I get the same error.
I get this error after Updating Database by a Migration or at the line:
if (Database.GetPendingMigrations().Any()):
SQLite provider.
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
An error occurred using the connection to database 'main' on server 'C:\Users\...\Documents\Developer\WinForms Blazor2_2022_Book_Secure_Active\WinFormsBlazor\bin\Debug\net7.0-windows\AppData\AppDB.db'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: ''.
I created a AppData\AppDB.db in root project folder and set this db to Copy always then in the Onconfiguring in the DbContext:
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlite($"Data Source={Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))}\\AppData\\AppDB.db"
, options =>
{
options.UseNetTopologySuite();
});
}
I have no main Database, I don't understand why I have this setup worked in EF Core 6 for a year but after updating to 7 it is not working! any ideas to solve this problem?
Looks like you're hitting issue #29584. It will hopefully be fixed in version 7.0.3.
For now, you can work around it by manually updating the SQLitePCLRaw dependency:
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite" Version="7.0.2" />
<!-- Manually updated to fix NetTopologySuite issues -->
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>
I find the problem was using x => { x.UseNetTopologySuite(); } in the UseSqlite function when adding the ef core context, When UseNetTopologySuite() is there, Any access to the database give error: SQLite Error 1: ''. and if I remove UseNetTopologySuite() I get another error: sqlite error 1: 'no such function: initspatialmetadata'..
In Ef core 6.0.12 there is no problem and I can use Spatial Point type without any problems, even after migrating that includes a point type, several tables and views related to geometry are created automatically with Ef core 6.
I had to forget using Spatial types in EF Core 7 so that I can upgrade my EF core version.

SSRS 2016 - 'extension Name' is not valid

I am trying to set up a new subscription in SSRS 2016 and the Delivery options (E-Mail) aren't loading. Here is the error message:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
The value of parameter 'extension Name' is not valid. (rsInvalidParameter)
I have the SMTP server setup in the Configuration Manager and have sent test emails with it. Is there another configuration I might have missed?
I ended up trying to add it using powershell and finally got a useful error message telling me my version of SSRS didn't support adding schedules.
Exception calling "ListSubscriptions" with "1" argument(s): "System.Web.Services.Protocols.SoapException: The feature: "Subscriptions to reports" is not supported in
this edition of Reporting Services.
I am using Web, but apparently I need the Standard version to proceed
https://learn.microsoft.com/en-us/sql/reporting-services/reporting-services-features-supported-by-the-editions-of-sql-server-2016

SQL Server 2014 Native Client (12.0.0.0) - Any way to force Assembly Version (e.g. SqlConnectionString "Type System Version")?

I am writing an application (using .NET Framework 4.5.2 + SQL Server 2014 installed locally). The application needs to support both SQL Server 2014 and previous versions.
When reading data using the inbuilt SQLCLR-types (SqlGeometry, SqlGeography, SqlHierarchyID), the standard ADO.NET methods (e.g. DataReader.GetValues()) use the 10.0.0.0 assembly, and throw an exception due to a mismatch with the loaded (v11 or v12) version.
The reasoning is documented (though it takes a while to spot) in the Breaking Changes in SQL Server 2012 (for the 11.0.0.0 assembly). For SQL Server 2012, there are three workarounds listed:
Use Type System Version=SQL Server 2012 in the SQLConnection.ConnectionString
OR: Use app.config / runtime / assemblyBinding / dependentAssembly to re-map v10.0.0.0 to v11.0.0.0
OR (not a very "neat" way to handle it): rewrite your own code to manually deserialize from a SqlBytes instance...
When developing from a computer with SQL Server 2014 installed, the assembly version is v12.0.0.0, and similar issues arise:
System.InvalidCastException: Unable to cast object of type Microsoft.SqlServer.Types.SqlGeometry to type Microsoft.SqlServer.Types.SqlGeometry.
For SQL Server 2014 (other than the horrible manual deserialize approach), there only seems to be one workaround (not officially documented in the breaking-changes) - it would appear that the v4.5 SqlConnection hasn't yet caught up with the version of SQL Server:
Use app.config / runtime / assemblyBinding / dependentAssembly to re-map v10.0.0.0 to v12.0.0.0
Question: other than re-mapping v10.0.0.0 to v12.0.0.0 in app.config (which seems to work), is there any other (easier) approach that will use the referenced assembly version?
A quick code-example below shows the failure (without the assembly-remapping in place):
private static void DoStuff()
{
SqlGeography geog_val = SqlGeography.STGeomFromText(new SqlChars("POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))"), 4326);
SqlGeometry geom_val = SqlGeometry.Parse("LINESTRING(1 1,2 3,4 8, -6 3)");
prm_geog.Value = DBNull.Value; prm_geom.Value = geom_val; ReadReturnedSpatialColumns(cmd);
prm_geog.Value = geog_val; prm_geom.Value = DBNull.Value; ReadReturnedSpatialColumns(cmd);
}
private static void ReadReturnedSpatialColumns(SqlCommand cmd)
{
using (var dr = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
dr.Read(); var items = new object[2]; dr.GetValues(items);
var geog_test = dr.IsDBNull(0) ? SqlGeography.Null : (SqlGeography)items[0];
var geom_test = dr.IsDBNull(1) ? SqlGeometry.Null : (SqlGeometry)items[1];
}
}
This issue still exists with Framework 4.6.1 and there appears to be no workaround apart from the 3 you've already discovered. So the short answer to your question is no.
However I would question if you really need version 12 of the spatial types, because (as far as I can tell) they don't add anything over the v11 types. If you'd prefer to use the v11 types so you can use the Type System Version=SQL Server 2012 workaround, you can install the Nuget package that incorporates all three versions (10, 11, 12) - it's specifically designed to allow you to deploy to servers where MSSQL may not be installed.
As a bonus, referencing that package directly and using Type System Version=SQL Server 2012 will ensure that your app will always be using the 2012 spatial types, so upgrading to SQL 2016 won't break anything if it decides to return a different version of them (e.g. 13, or 14, or whatever 2016 will use) by default.

EF Code First Migration throws StackOverflowException on Azure Web Role

The issue occurs when executing EF 6.1.2 code first migrations in an Azure Web Role (WS 2012 R2). The same migrations run fine locally, even if I point the connection string to the (Azure) Sql Database.
The StackOverflowException is thrown by Entity Framework code, and the first line of ANY of my migrations doesn´t even get hit.
I have tried running the migrations in three different ways:
DbMigrator migrator = new DbMigrator(configuration);
migrator.Update(); // Here the exception is thrown
second:
DbMigrator migrator = new DbMigrator(configuration);
pendingMigrations = migrator.GetPendingMigrations().ToList();
foreach (string pendingMigration in pendingMigrations)
{
migrator.Update(pendingMigration); // Here the exception is thrown
}
and using web.config:
<contexts>
<context type="Superb.WorkNextDoor.EFRepository.Context.WndDbContext, Superb.WorkNextDoor.EFRepository, Version=1.0.0.0, Culture=neutral">
<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[Superb.WorkNextDoor.EFRepository.Context.WndDbContext, Superb.WorkNextDoor.EFRepository], [Superb.WorkNextDoor.EFRepository.Migrations.Migrations.WndDbMigrationsConfiguration, Superb.WorkNextDoor.EFRepository.Migrations]], EntityFramework">
</databaseInitializer>
</context>
</contexts>
I see the StackOverflowException in Visual Studio when I´m remote debugging the web role. An error is recorded in windows event log of the web role (log info at the bottom of this post).
I have two migrations. I have tried running the first one from PMC and the second from the web role but no luck.
I have tried installing .Net 4.5.2 on the server, changing the VM size from XS to S and downgrading EF to version 6.1.1. Nothing worked. Also, I tried downloading the folder "E:\sites\0" from the web role to my local computer, installed the app on IIS and attached my VS Debugger and it doesn't throw that exception. There has got to be something different between my Windows 8.1 and that Windows Server 2012 R2.
I have spent a lot of time trying different things but I don´t want to give up on this and have to execute my migrations from package manager console.
Log Name: Application Source: Application Error Date:
1/11/2015 3:21:42 AM Event ID: 1000 Task Category: (100) Level:
Error Keywords: Classic User: N/A Computer:
RD0003FF508F5B Description: Faulting application name: w3wp.exe,
version: 8.5.9600.16384, time stamp: 0x5215df96 Faulting module name:
clr.dll, version: 4.0.30319.34014, time stamp: 0x52e0b86c Exception
code: 0xc00000fd Fault offset: 0x0000000000195499 Faulting process id:
0xc60 Faulting application start time: 0x01d02d4d77fdfb93 Faulting
application path: d:\windows\system32\inetsrv\w3wp.exe Faulting module
path: D:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Report
Id: f5e4d6dc-9940-11e4-80bd-0003ff508f5b Faulting package full name:
Faulting package-relative application ID: Event Xml:
1000
2
100
0x80000000000000
467
Application
RD0003FF508F5B
w3wp.exe
8.5.9600.16384
5215df96
clr.dll
4.0.30319.34014
52e0b86c
c00000fd
0000000000195499
c60
01d02d4d77fdfb93
d:\windows\system32\inetsrv\w3wp.exe
D:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
f5e4d6dc-9940-11e4-80bd-0003ff508f5b
Easy steps to reproduce this error:
Download this sample project: http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
Add a CloudServiceProject to the solution and add the web project as a web role
Publish it to azure
Browse the web site and go to students tab (this hits the database and the initializer tries to execute the migrations).
Happens the same.
This is identified as a bug in Microsoft Visual Studio 2013 Update 4. As a temporary work around disable "Lazy Initialization" under IntelliTrace Settings -> IntelliTrace Events. We are investigating fixing this bug in a future update for Visual Studio 2013.
The responsible for the StackOverflowException turned out to be IntelliTrace. I don't know the root cause of the issue between IntelliTrace and Code First Migrations that cause this behavior but when I downloaded the IntelliTrace logs I could see a lot of Sql exceptions:
I have already lost a lot of time with this so I won't investigate it further. The easiest workaround for me now is just disable IntelliTrace before deploying my Web Roles:
If somebody is curious, here are the IntelliTrace logs.
I hope this helps someone else solve such a problem without losing as much time as I did.

JasperReports Server: ERROR SubstitutionVariable No getter method?

In our Tomcat logs in on JasperReports Server 5.0.1 we are getting this error on a few reports.
I have checked the reports and couldn't find anything that might cause this error.
There is no parameter with the name "campus_id" in the XML or any input control of these reports
Any idea what could cause this error ? or how to fix it
2013-11-06 12:15:55,119 ERROR SubstitutionVariable,pool-24-thread-5:194 - No get
ter method getCampus_id for campus:campus_id for class com.jaspersoft.commons.da
taset.expr.Literal
java.lang.IllegalArgumentException: Missing property: campus_id
at com.jaspersoft.commons.dataset.expr.SubstitutionVariable.getProperty(
SubstitutionVariable.java:111)
at com.jaspersoft.commons.dataset.expr.DataSetExpressionParser.varRef(Da
taSetExpressionParser.java:1910)
at com.jaspersoft.commons.dataset.expr.DataSetExpressionParser.term(Data
SetExpressionParser.java:1539)
at com.jaspersoft.commons.dataset.expr.DataSetExpressionParser.multDivEx
Note: I am using: iReport 5.0.0, JR Server 5.0.1, Windows 7 Pro 64bit, Tomcat 7