Connection fails to load from app.config file using ADO.Entities in DAL

I have Data Access Layer setup where Entities are retrieved from a DB, everything is fine in design view... When I compile the project and deploy it, I get an error that says:

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. 

So clearly somehow the app.config info is absent from the DLL. How can I resolve it. I don't want to put the Connection String in web.config because UI should now know anything about the Connection.

Please let me know, thanks.

0
LastManStanding
3/25/2009 2:46:33 AM
asp.net.config-deploy 12495 articles. 0 followers. Follow

3 Replies
831 Views

Similar Articles

[PageSpeed] 40

 btw, nowhere even on the web I can find an example of how to set the connection string programmatically for the entity, Hmmm.


0
LastManStanding
3/25/2009 3:04:28 AM

Hi,

From your description, I understand that there is Class Library used to access database for your ASP.NET application, and you don't want to place the connection string in this ASP.NET application's web.config file.

If you are use app.config file to save connection string in Class Library, you also need to copy it to ASP.NET application's Bin folder with this DAL assembly.

I suggest you place connection in web.config file after integrating.

 For example, see http://www.schnieds.com/2008/01/aspnet-20-dataset-connectionstring.html

 

 I look forward to receiving your test results.


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Thomas
3/27/2009 8:41:20 AM
I had the same scenario. Don't fall into the trap I did and assume that the Entity Framework will pick up your "development" connection string as a default unless you specify another in your exes config file.


You may need to copy the connection string section from the DLL app.config file into your EXE's app.config or if you are calling the data access layer DLL from a web app the web.config file.


I was actually calling my data access layer DLL from another DLL that contains NUnit test fixtures. I ended up having to add the ConnectionString setting to a configuration file called "ProjectName.csproj.config". This is contrary to what the NUnit help file suggests where it says the ".csproj" should be changed to ".config".


Hope this saves you, and anyone else with the same problem, some time. I too didn't find much help when I Googled the error message.

BTW: You can programmatically pass a connection to the constructor of your Context Object. Start by looking in the help file for the "EntityConnection" class and the EntityConnectionStringBuilder class.
Phil
0
UnityPhil
4/2/2009 9:23:59 AM
Reply:

Similar Artilces:

Web App connecting to database using web.config file
I am using the web.config file to store my database connection string. Everything was working fine when I was running to applicaiton on my local machine. However, when I deployed to the web I keep on getting this error: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at Dev_verI.Basi...

Need to put this in a web.config file. Transfer a collection from app.config to web.config.
<!--<setting name="Groups" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>GL CA Corporate Data</string> <string>GL CONT Contractors</string> <string>GL IT SolutionDelivery</string> </ArrayOfString> </value> </setting>-->   I need to put this in the below web.config.<?xml version="1.0"?><!-- Note: As an alternative to hand editing this fi...

Use a Name/value in Machine.config file in the web.config file
Hello. I want/need to access a variable in the machine.config file and use it in the web.config file. My scenario is: Each machine has a machine name, so (I assume this is the best place to put it) I want to create a variable in <appsettings> in the machine.config file called "MachineName".  In my web.config file, I want to use the MachineName variable in the machine.config in the appsettings.   Example: (web.config file)  ... <appSettings> <add key="ServerFileNames" value=\\ISCO1FEGRD\Dotnet_files\OrclIntlList.xml /> Replace the ...

ConfigurationManager fails to correctly load changed external connections.config ConnectionStrings file
>>Resolved myselfGee, only 22 people looked at this (and hundreds if not thousands looked at the other posts on my page) before I figured it out myself. So simple - so surprised no-one could reply. Surely someone has used this - guess my Subject line is too complicated.Hope the next person looking can use this:ConfigurationManager.Refresh();  // causes the settings to be re-read from the disk. Just couldn't find it in MS Help or any post here - probably working too many hours. Still have the 4 apps / want 1 config file problem when each app has its own folder - guess I...

Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application
 Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application  please help me? Friend, Web.config has its own advantages. 1) Web.Config is used to store the important information like connections strings etc...so that it can be modified even after the code has been    deployed to the server without compiling the entire application again. 2) Since it is a XML file, there is no need of building the project of you are going to change the connection strings.   If you go for the class files,...

[PATCH utils/h2xs.PL] use Config; use Config; require Config;
I happened to notice h2xs was using Config.pm a bunch of times. This removes the duplicates. --- utils/h2xs.PL 2002/03/03 18:31:12 1.1 +++ utils/h2xs.PL 2002/03/03 18:31:25 @@ -688,7 +688,6 @@ my $module = $opt_n; if( @path_h ){ - use Config; use File::Spec; my @paths; my $pre_sub_tri_graphs = 1; @@ -867,7 +866,6 @@ } open(XS, ">$modfname.xs") || die "Can't create $ext$modpname/$modfname.xs: $!\n"; if ($opt_x) { - require Config; # Run-time directive warn "Scanning typemaps...\n"; get_typem...

app.config and web.config deployments and installers
I use web deployment projects for changing web.config values based on the configuration build types I have setup (dev/test/stage/prod) and it works excellent for building installers in multiple environments.  Now, I am trying to do the same the Windows Applications.  How can I automate the changing of app.config values based on the build configuration (dev/test/stage/prod)?  Any help would be much appreciated. Thanks,Chris...

web.config, app.config Connection strings
Hi all,   My difficulty is the configuration of the following Connection String.    <connectionStrings>        <add name="RMS_DAL.My.MySettings.RMSConnectionString" connectionString="Data Source=DEV01;Initial Catalog=RMS;Integrated Security=True"            providerName="System.Data.SqlClient" />    </connectionStrings>    In visual Studio  I have a 3 tier "Solution" like this  &nb...

app.config in DAL and deployment
We are building a 4-layer webapplication. The connectiestrings are placed in the app.config automatically by when we builded a typed dataset. When we release the webapp and deploy it, the app.config is gone, but the application is still working. Is this correct and where did it go?Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". Some connection string are defined in machine.config or web.config file at machine level. So when you deploy it, they are moved from app.config to machine.config? (I d...

app.config connection string not being read
I have a Web app that has a UI Website Project and a DB dataset/db project. I am running SQL Server 2005 Express on my localhost for development purposes. I have the connectionstring for the DB in the DB projects app.config. The site is running perfectly on my localhost, but when I deploy the site to the review server and change the app.config's connectionstring accordingly a connection to the DB cannot be established. I then tried changing all the db names, usernames, password to jibberish in my app.config file on my localhost and running AND THE SITE STILL RAN ON LOCALHOST. For so...

After migration from .Net 1.1 to .Net 3.5 do I have to incorporate new web.config settings in old *.config file
Hi,I have successfully migrated web application from .Net 1.1 to .Net 3.5. Could you let me know whether I have to incorporate setting in new web.config (this new web.config file was generated automatically due to migration) into old *.config file?FYI: Old *.config file contains all application level settings required. So I will continue to use old.config file by removing new web.config file. Settings which are in new web.config file are:<configSections><sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup,...

[PATCH lib/Net/Config.pm, MANIFEST, t/lib/Mock/Socket.pm, lib/Net/Config.t] Add Tests for Net::Config
Here's a test suite for Net::Config. In the process of writing this, I've fixed an apparent bug that prevented single values from becoming array references when necessary. I think it's right, but perhaps Graham should weigh in on this. In the process, with some advice from perl-qa, I've added a mock object so the test could control the output of Socket::inet_ntoa() and Socket::inet_aton(). t/lib/Mock/ seemed like as good a place as any. I'm happy to rework this patch if it personally offends anyone whose opinion matters. :) -- c --- lib/Net/~Config.pm S...

seriously confused about connections strings, app.config, web.config ...
I have a web application that comprises the following: A web project (with a web.config file containing a connection string - but no data access code in the web project) A data access project that uses LINQ-SQL classes to provide entities to the web project UI (this project has a settings file and an app.config - both of which have connection strings) When I build and deploy, there is no settings file or app.config in the Bin directory with the data access .dll, but changing the connection string in the web.config file doesn't change the database accordingly - so ...

[svn:parrot-pdd] r14888
Author: coke Date: Tue Oct 10 19:16:37 2006 New Revision: 14888 Modified: trunk/docs/pdds/clip/pddXX_cstruct.pod (props changed) trunk/docs/pdds/clip/pddXX_pmc.pod (props changed) Changes in other areas also in this revision: Modified: trunk/ (props changed) trunk/apps/p3/README (props changed) trunk/apps/p3/cgi-pir/slides.pir (props changed) trunk/apps/p3/index.html (props changed) trunk/apps/p3/p3p.css (props changed) trunk/apps/p3/p3p.html (props changed) trunk/apps/p3/slides.js (props changed) trunk/cage/consting.pod (pro...

Web resources about - Connection fails to load from app.config file using ADO.Entities in DAL - asp.net.config-deploy

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Complex Regional Pain Syndrome: CPRS researchers study auditory connection
For 16 years Kerry Whyman ``secretly&quot; thought she had bone cancer and was dying secretly because she'd stopped telling doctors how much ...

Fictional Lawyers Use Their Family Connections Too
This film character had a family connection to his lawyer.

The Direct Connection
... And the people reading my words respond back to me with words of their own. The technology that allows this is powerful but this direct connection ...

Is There A Connection Between Patrick Murphy's Over-The-Top Corruption And His Campaign Emails?
The DCCC may be stupid or even very stupid (as well as utterly incompetent) but their e-mail strategy is very well-planned out. Their overarching ...

Internet connections at UK universities have been knocked out by a 'persistent' cyber attack
... internet following a targeted cyber attack on a nationwide education network. The University of Manchester said on Tuesday its internet connection ...

CNN: Investigators Find ISIS Connection In San Bernardino Shooting
As the San Bernardino attack was happening, the female shooter, Tashfeen Malik posted on Facebook, pledging allegiance to ISIS leader Abu Bakr ...

Resources last updated: 12/8/2015 10:35:13 PM