0

I have a ASP.NET MVC application which uses EF (v6) as data access layer. My application works fine on IIS Express and also when deployed to the server running IIS 7.5. The problem is that I'm getting the following exception when I deploy it to Azure (Web Sites).

Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception.

I've searched the web and I made sure my connection string starts with "metadata=" + checked my db context class' constructor to be sure it contains the correct name (in my case it's "name=PsDataEntities"))

My connection string looks like this: <add name="PsDataEntities" connectionString="metadata=res://*/PsDataModel.csdl|res://*/PsDataModel.ssdl|res://*/PsDataModel.msl; provider=System.Data.SqlClient; provider connection string=&quot;data source=SERVER_NAME;initial catalog=DB_NAME;user id=UID;password=PWD; MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Anybody had the same problems?

Any help is appreciated

vhr
  • 1,528
  • 1
  • 13
  • 21
  • Is this your azure connection string or local database connection string – parthicool05 Aug 13 '14 at 04:11
  • Azure connection string. I'm connectiong to the SQL Server running on Azure when doing my tests - same connection string for all the tests (local, server, Azure website) – vhr Aug 13 '14 at 12:44
  • Azure connection string is different while running the project in azure that's why I am asking friend.. – parthicool05 Aug 13 '14 at 12:47

1 Answers1

0

I did a few more tests (like changing metadata in the connection string to use fully qualified names instead of '*') without success, then I decided to set my metadata (regarding .csdl/.ssdl/.msl) programatically with the help from this post. Application now works correctly when deployed to Azure.

Community
  • 1
  • 1
vhr
  • 1,528
  • 1
  • 13
  • 21