app.config connection string not being read - phantom connection string being used instead

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 some reason when the Dataset pull the connection string they are getting some bizarre version of what the connection string should be.

I did a little snooping - in the dataset the connection string is acquired by:

this._connection.ConnectionString = global::MyCompany.MyProject.DB.Properties.Settings.Default.projectConnectionString;

I then looked at the Settings.Designer.cs which pulls the pilotConnectionString value - it looked like this:

... namespace and some other tags ..

internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

   private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

public static Settings Default {   get { return defaultInstance; } }

[global::System.Configuration.ApplicationScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)][global::System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.10.100;Initial Catalog=mycatalog;Persist Security Info=True;User ID=myuser;Password=mypassword;")]

public string projectConnectionString {get { return ((string)(this["projectConnectionString"]));}}

}

It looks like when global::MyCompany.MyProject.DB.Properties.Settings.Default.projectConnectionString; is referenced the Default property is used - at this point i can check in the debugger and see the connectionString is "Data Source=localhost//SQLEXPRESS;Initial Catalog=mycatalog;Persist Security Info=True;User ID=myuser;Password=mypassword"

I then check again when the projectConnectionString's Get property is hit, and it is again, "Data Source=localhost//SQLEXPRESS;Initial Catalog=mycatalog;Persist Security Info=True;User ID=myuser;Password=mypassword"

I've dont searches on the entire solution and i cannot find the string SQLEXPRESS anywhere - the other weird part is the Initial Catalog, UserID and Password are all correct for my project!!

Does anyone have ANY IDEA where this phantom connection string is coming from, why it is being used and how i can use my Settings/app.config connection string?

Thanks

 

 

0
empire29
8/4/2006 12:03:14 AM
asp.net.config-deploy 12495 articles. 0 followers. Follow

0 Replies
1252 Views

Similar Articles

[PageSpeed] 18

Reply:

Similar Artilces:

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...

OLEDB Connection problem using Connect String from Web.config
Hi,Cananybody tell me why I am getting the following error for the following code below An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'. "Ppp" is a connection defined in Web.config which works with SqlDatasource in the application. DataSet RunQuery(String QueryString) { String ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Ppp"].ConnectionString; OleDbConnection DBConnection = new OleDbConnection( ConnectionString); OleDbDataAdapter DBAdapter; DataSet ResultsDataSet = new DataSet(); M....

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 ...

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,...

Putting this connection into a config connection string
Hi I have as so many others before me built the perfect site that runs 100% locally but when it is uploaded to the server and you try to connect to your online DB it falls over. I know i need to change the connection string, but i have tried nearly every configuration possible and still have no access. I eventually asked my hosting company and they sent me the following script:   string myConnectionString = "Database=<***>; Data Source=mysql16.easycgi.com;User Id=<***>;Password=<***>"; MySqlConnection myConnection = new MySqlConnection(myConnectionStr...

How do I use my web.config connection string in my DataAdapter/Connection that I created with drag/drop and data binding
This is a little hard to put into words... I have a form with a number of textbox fields on it that are bound to a data adapter. The data adapter and it's sql connection were created by dragging the objects onto the screen from the toolbox (not in code). I open connections in other places and use my connection string in web.config for those. The on-screen sql connection object doesn't seem to allow me to just fill in the function that pulls my conn string from web.config so in page.load, I set it's connection string to my connection string. Does the page load fire before the connect...

Get connection string from web.config and secure that connection
Hi, I store my connection string on my web.config file, and I want to create a new connection on c# like:SqlConnection con = new SqlConnection();con.ConnectionString= //connection string on web.config fileAfter that, The connection string on the web.config file is in clear text and I want to make it secure but easy to work because this job is to deliver until friday. Is there any easy way to do this and keep the possibility of creating a new connection and making reference to this connection string without need for decrypt data?Thanks, please help!Best regards,David Ribeiro After reading t...

web.config having multilple connection string name with same connection.
Issue 1:   <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/>  And use Conn1(Read and Write from DB)  All over the application. (for exam: all Data Access Layer). VersusIssue 2: <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/> <add name="Conn2" connectionString="Data Source= SID ;User Id=UN;Password=Pwd" providerName="Or...

Using a connection string from web.config
Ok. I thought this was going to be easy but it is turring out to be harder than I expected. I want to use a database connection string from the web.config file. If I use a sqldataadapter and configure a connection then the page works fine. If i attempt to use the information from the web.config file I get the following message when attempting to connect to the DB. The ConnectionString property has not been initialized. Here is the code that I am using to establish the connection. Imports System.Web.Security Imports System.Data.SqlClient Public Class WebForm1 ...

HOW TO USE THE CONNECTION STRING IN WEB.CONFIG
I have a connection string defined in the web.config file and as you know it is given a name.How can I reference such a connection string from a web form using the name given in the web.config file?What I actually do is to copy and paste the whole string in my web forms as follows:Dim pgConn As New PgSqlConnection("User Id=postgres;Password=p@ssw0rd;Host=localhost;Database=e-restdelivery;Persist Security Info=True;Schema=restaurant;Protocol=2")This method is not efficient because if the string changes I have to modify every web form where a connection string is locat...

How to use Connection String from Web Config
Hi All, How do I use the Web Config connection string in code behind? What is the syntax Dim oCnn As New SqlConnection= ???? Thanks    Dim oCnn As New SqlConnectionoCnn.ConnectionString = ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionStringDont forget to import System.Configuration Regards Mike [MVP - ASP/ASP.NET]My site...

connection strings in web.config are read only
I'm trying to modify connection strings in the web.config from a web page, I get error "configuration is read only" (referencing system.configuration).  here's the code:<!-- Web.Config Configuration File --> <configuration><system.web> <customErrors mode="RemoteOnly" defaultRedirect="index.aspx"/><compilation debug="true"/></system.web> <connectionStrings> <add name="HS1ConnectionString" connectionString="Data Source=C:\Hydrosaver\Support\Programming\HS1.mdb;Persist Securit...

Connection Strings and web/app.config
Hello All, Something I've never really understood. Why put db connection strings in the web.config which is the presentation layer? Surely the presentation layer (and the business layer) should't need to know absolutely anything about the database? I have a data access layer consisting of many class libraries and all data access objects in these class libraries inherit from a single class (called DBObject) in a "core" class library. If I put connection strings in the app.config of this core project, and the only code to reference it was in this DBObject Class, then wouldn't tha...

connection string in Web.Config file not being read
I have a problem with deploying my web site. I am using a connection string stored in the web.config file. I have tried to change the entry to reflect the location of the database on the server, but the changes are not reflected when running the site. Original Configuration Key: C:\OldKitchenNet\Kitchen.mdb New Configuration Key: <appSettings> <add key="con" value="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\Databases\ResearchDB.mdb; Jet OLEDB:Database Locking Mode=0;" /> </appSettings> When I run the site it gi...

Trying to use web.config for connection strings
I am trying to use a web.config file to store my connection string for my web app, but I am unable to retrieve the stored values, here is the code to my web.config and the sample page I'm testing. Sample Page dim strSql as string dim ds as dataset dim da as oledbDataAdapter dim Conn as string dim myconn as oledbConnection sub page_load(Sender As Object, E As EventArgs) lblDate.text = "Today's Date is: " & date.now.tostring() GridLoad() End sub Public sub GridLoad() strSql = &qu...

Web resources about - app.config connection string not being read - phantom connection string being used instead - 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 ...

Ben Garcia gives Penrith Panthers a new French connection
Should he jag a game in the NRL, Ben Garcia will become just the third genuine French import to do so.

Man Charged With Aggravated Arson In Connection To Columbus Warehouse Fire
Police have charged 30-year-old Robin Toms with aggravated arson.

Facebook becomes more adept at dealing with crappy connections
... to get a decent phone signal to allow you to post a photo of your meal. Joking aside, in countries where people are struggling with 2G connections ...

Adam Savage from 'MythBusters' has an incredible connection to the 'Star Wars' franchise
Adam Savage, co-host of the popular " MythBusters " television show, soured on the plot of "Interstellar." But when it comes to the newest films ...

French authorities detain suspects in connection to attacks 10 months apart
CNN French authorities detain suspects in connection to attacks 10 months apart CNN A forensic scientist works near a Paris cafe on Saturday, ...

UK Police Make Arrest in Connection With VTech Hacking
British law enforcement officials arrest a 21-year-old man in connection with attack on toy maker VTech that exposed 6 million parents and children ...

Resources last updated: 12/22/2015 6:04:11 AM