Nov 11

Using code first approach with Entity Framework generates Unable to load the specified metadata resource error

I’ve setup a solution with a WebAPI and a MVC 4 application. I’m using the Entity Framework 5 which stores it data into a SQL Azure database. In the package manager console I typ: enable-migrations and get the error:

Unable to load the specified metadata resource.

This due to the context connectionstring in the web.config. Check if you have the right settings under <connectionStrings>

 

Aug 02

Publishing to Azure: Could not load file or assembly ‘Microsoft.Web.XmlTransform,Version=1.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies

When publishing my MVC 5 webapp to Azure I get the error:

The “ImportParametersFile” task failed unexpectedly. System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Web.XmlTransform,Version=1.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. File name: ‘Microsoft.Web.XmlTransform, Version=1.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

I’m using Visual Studio 2012 Update 4. Azure SDK 2.3.

I’ve tried:

– reinstall azure SDK
– reinstall Web Tools 2013.1 for VS2012
– installed slowcheetah nuget package
– installed Microsoft.Web.xdt nuget package
– uninstalled VS 2013

So far no luck, the Microsoft.Web.Xmltransform.dll is just missing and the version that is somewhere on my system is the wrong version. I’ve tried to find the 1.4.0.0 version somewhere, but it seems unfindable.

MY SOLUTION:

– repair Microsoft ASP.NET & Web Tools 2013.1 Visual Studio 2012

reinstall does not work

Oct 09

In Visual Studio 2012 a horribly slow performance on MVC 4 website running in Azure Emulator

I experience in Visual Studio 2012 a horribly slow performance on MVC 4 website running in Azure Emulator. The symptoms

  • very slow response on your MVC 4 website with Azure webproject
  • timeouts
  • website often unresponsive
  • no difference in performance using SQLExpress, Local IIS Web server or Visual Studio Development Server
  • when pausing the webapp during waiting for page loading the stack with external code displays Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint.Run()
  • ERROR_WINHTTP_AUTODETECTION_FAILED (12180) in the Azure Compute Emulator

As usual it took many hours to figure everything out and it took me 5 seconds to apply the solution:

  • goto Internet Explorer
  • Tools
  • Internet Options
  • Connections
  • LAN Settings
  • uncheck “Automatically detect settings”

My site is now running 10-20 times faster and is always responsive now :-)

Mar 24

Tables without a clustered index are not supported in this version of sql server

I try to do an insert in to n:n (SQL Azure based) related tables (UserSet and TenantSet) using the Entity Framework, but it fails with the error: “tables without a clustered index are not supported in this version of sql server”. I’ve used the model first approach to generate the SQL database, so the SQL Server database should be fine.

After extensive search it seems that the table UserTenant has no clustered index. The script that the Entity Framework generate contains (in my opinion) an error. The relevant part of the script is:

Creating primary key on [User_UserId], [Tenant_TenantId] in table ‘UserTenant’

ALTER
TABLE [dbo].[UserTenant]
ADD
CONSTRAINT [PK_UserTenant]
PRIMARYKEY NONCLUSTERED ([User_UserId], [Tenant_TenantId] ASC);
GO

Of course the NONCLUSTERED parameter should me CLUSTERED. Change that and run the script again.

That’s all, hope the Entity Framework team resolves this what looks like a bug.