No connection string named "thenameofmyconnection" could be found in the application config file

I am working with entity framework and azure, I got a WCF in a web role which uses methods from the project with entity framework..it seems that I am placing the connection string on the wrong file or that I am defining it wrongly.. it is as follows :

<connectionStrings>
  <!-- Windows Azure SQL Database Connection String -->

  <add name="AMTEntitiesContainer" 
   connectionString="here goes my connection string" 
   providerName="System.Data.EntityClient" />

</connectionStrings>

This is inside my app.config file in my entities library project..should it go to into the config of my webrole? or should it go into my WCF service ?

Upvotes: 6

Views: 5960

Answers (4)

Joshua Simon Bloom
Joshua Simon Bloom

Reputation: 581

I had this, Simply because I was creating my model incorrectly. I was incorrectly doing:

var model = new ModelName;

Instead of correctly doing:

var model = ModelName.Create();

So this error may be thrown for a simple reason like that

Upvotes: 0

user1300630
user1300630

Reputation:

This could be also helpful to understand these things.

I'm sorry for the post, I can not write comments yet.

Upvotes: 1

D4rkTiger
D4rkTiger

Reputation: 362

If it is the WebService that interact with Azure, you need to move this into its Web.config. If it's the application you have another problem.

Upvotes: 0

Andy Nichols
Andy Nichols

Reputation: 3002

The connection string should be in the web.config of the WCF service. The EntityFramework project will be executed in-process. The WCF service is the process running.

Upvotes: 8

Related Questions