Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search


C# - Managing A Debug And Release Connection String

What is a good approach to managing a debug and release connection string in a .NET / SQLServer application? I have two SQL Servers, a production and a build/debug and I need a method of switching between the two when my ASP.NET application is deployed. Currently I simply store them in the web.config and comment one or the other out, however that is error prone when deploying.

View 6 Replies (Posted: Mar 4 10 at 21:24)

Sponsored Links:

Related Forum Messages For ASP.NET category:
What's Release Build And Debug
I have few confusions about build. What is release build and debug build? What are the output files for these builds? I had seen debug and release folders in bin folder. So the respective output goes into the respective folder? elaborate release and debug build. I dont want the difference.

Posted: May 19, 2010 04:52 AM

View 3 Replies!   View Related
What Is The Difference Between Debug Vs Release Mode
What is the difference between debug vs release mode.

Posted: Sep 20, 2007 07:04 AM

View 5 Replies!   View Related
Can Specify If Aspnet_compiler.exe Creates A Debug Or Release Build
I wish to compile my MVC application using aspnet_compiler.exe from the comandline to speed up cold startup.

I'm wondering how it determines if it should do a release or debug build. Is it always release? Does it depend on what the web.config file says when you run aspnet_compiler.exe?

What happens to an application that's been compiled w/ aspnet_compiler.exe if someone changed the debug attribute in the web.config file after it has been published?

Posted: Apr 16 10 at 0:11

View 4 Replies!   View Related
How To Know Whether Application Is In Release Or Debug Mode Using Code
My requirement is tocheckwhether my applicationis in debug mode or release mode in DLL class.

Posted: Apr 30, 2010 05:45 AM

View 6 Replies!   View Related
Configuration :: Setup Debug And Release Builds On The Same IIS?
I'm on Windows Server 2008 with IIS 7.5 I have set up two web applications on the web site; one for the debug-build and one for the release-build for our system. I have not been able to figure out how to setup the two web applications so that they do not share the same native module.

When I access the debug-application (http://dev1/debug) it loads "G:workspaces ewreposdebuginRXWeb.dll" and the site works fine. However, when I access the relase-application (http://dev1/release) it also loads the "G:workspacesewreposdebuginRXWeb.dll" which is not want I want. I want it to load the "G:workspacesewreposeleaseinRXWeb.dll". Apart from that the relase-application works fine, loading for example its own database, javascript-files, images and so on.

I have tried many different configuration but obviously there is something I do not understand.

Theseare the changes I have made to applicationHost.config:

Under the section <globalModules> the following to rows are added at the end:

<add name="RXDebug" image="g:workspaces
ewreposdebuginRXWeb.dll" />
<add name="RXRelease" image="g:workspaces
eleaseinRXWeb.dll" />
Theweb.config for the debug-application looks like this:
<?xml version="1.0" encoding="UTF-8"?>

Posted: May 29, 2010 07:03 AM

View 2 Replies!   View Related
Web.Config Values To Be Specific To Release Versus Debug
Is it possible to make some values in my Web.Config file dependent on whether I am building a release or debug based ASP.NET application?

Posted: Jul 7 10 at 13:06

View 3 Replies!   View Related
Use The ScriptManager To Manage Release And Debug Versions Of My JavaScript?
I have an application that uses various script files. These files are not used for any AJAX purposes. However, I am using MS AJAX Libraries. My goal is to use the ScriptManager to manage release and debug versions of my JavaScript. Is this the right approach? Is there a better way to handle this task?

Posted: Oct 26 10 at 13:22

View 1 Replies!   View Related
Configuration :: Deploy Code With Both Release And Debug Mode
any way to deploy code with both release and debug mode together. I know it is logically impossible.

My requirement is to deploy debug based aspx page(for temporary) in release mode build in prod.. the concept is to avoid to put full release build on production again & again.

Posted: Jan 19, 2011 07:32 AM

View 2 Replies!   View Related
Visual Studio :: Script Debug With 2010 Release And IE8?
I am having a hardtime script debugging in VS2010 and IE8. I am using .net 4 framework.When i try to make a break point in my client script in VS2010, i get the respond "This is not a valid location for a breakpoint". ThenI have tried to use IE8 Developebar, but when i try starting the script debugger it throws an alert, and tell's me that it couldent attatch to the process, because there may be anotherdebugger attatched to the process.

Posted: Apr 17, 2010 09:05 AM

View 4 Replies!   View Related
Visual Studio :: References In Debug Versus Release Mode
I am developing a web site in Visual Studio 2008. I have a project for the web application and several class libraries as references. When I add the references I select the fileunder bin/debugin the class library folder. When changing the project to release mode the references still point to the .dll in the debug folder. Shouldn't this change automatically. How should I add the references so that debug and release are properly referenced?

Posted: Nov 01, 2010 07:59 PM

View 1 Replies!   View Related
Forms Data Controls :: Change Production Connection String To Test Server Connection String?
When using connection wizard to connect to database, how can we change production connection string to test server connection string and vice versa(at run time)?

Posted: Nov 19, 2009 04:58 PM

View 4 Replies!   View Related
Provider Connection String Of Entity Framework Be Substituted With A DB Connection String Already Defined In Web.config?
I have a db connection string 'ApplicationServices' defined in the connectionString section of web.config and 3 Entity Framework connection strings which have the provider connection string attribute with the same connection string as the one in 'ApplicationServices'. Is there a way to reference connectionString in 'ApplicationServices' for the provider connection string attribute of the EF connection string in the web.config, rather than providing the connection string all over again?

Posted: Feb 2 at 16:14

View 1 Replies!   View Related
C# - What Is The Difference Between Debug Mode And Release Mode In Visual Studio 2010
Possible Duplicates: Debug/Release difference Performance differences between debug and release builds

What exactly is the different in compiling and running an project in Debug mode VS Release Mode?

Posted: Mar 17 at 12:03

View 3 Replies!   View Related
Difference Between Debug And Release Folder Present Inside The Bin Folder
difference between debug and release folder present inside the bin folder in

Posted: Feb 09, 2009 07:51 AM

View 3 Replies!   View Related
Visual Studio :: Debug Configuration Will Only Build Release Configuration?
I have a windows application that was original built in vs2003 (1.1) and we have upgraded to VS2008 SP1 (2.0). We are trying to build this application in debug mode or just run it in debug mode and it continues to build it as if the configuration is Release. I have had this happens with several similar projects now and have ended up modifying the Release configuration to build with debug information but this isn't the best solution. Is there something I am missing?

Posted: Aug 20, 2009 07:36 PM

View 2 Replies!   View Related
Release Mode Versus Debug = "false"
I'm trying to find a definite explanation of what effect compiling in release mode has on a .Net 3.5 web application versus debug="false". So far it looks like setting debug="false" has the same effect and compiling in release mode has been depreciated but I can't find any firm evidence this is the case.

This question looked promising but seems to be answering what's the difference between debug and release builds rather than release mode and debug="true":


However it does link to this article:


"This new compilation model makes the Configuration Manager for a web site obsolete. The only option appearing in a Visual Studio 2005 web site "project" is a Debug configuration. Don't fret - it means nothing. The web.config file now rules the school."

Now that is the closest I've had to an answer and it does seem to imply that release mode has been depreciated in favor of debug="false" but I can't find any confirmation of this on MSDN or any other source.

clarify this is a "Web Application Project" I am referring to.

To rephrase my question slightly, if I have the following setting in web.config:

<compilation defaultLanguage="c#" debug="false">

What effect (if any) does release and debug mode compile have?

Posted: Jul 20 10 at 23:50

View 2 Replies!   View Related
Site Can Publish In Release Mode Or Debug Mode
how can i tell the diffence between a website that has been published in release mode and the same website that was published in debug mode

Posted: Sep 7 10 at 15:15

View 4 Replies!   View Related
SQL Server In Debug Mode And MySQL In Release Mode?
is there a way to use sql server to debug locally and mysql onthe remote published version ?perhaps with web.config and AppSettings ?

Posted: Jan 07, 2011 10:22 AM

View 3 Replies!   View Related
What Are The Web.debug.config And Web.release.config Files For
I just upgraded to VS 2010 and MVC 2.0 and I noticed the web.config has two additional files attached to it? Are these files used to specify debug and release specific settings, so you don't clutter up the main web.config?

Does it even make sense to place a connection string in the root web.config file if I have have a local and remote one in the debug and release web.configs respectively.

Posted: May 7 10 at 19:37

View 1 Replies!   View Related
Web Forms :: How To Access Connection Connection String From Sub Folder Web.config File
just for my testing purpose i know i can define both the connection's outside in a single web config file by different name's and access them in my front end according to it but what if i want to have seprate for both connection's web.config situation is like this see image so i want to access my connections from second web config file how i can do that.


i tired this but its giving error


Posted: Mar 15, 2011 06:30 AM

View 1 Replies!   View Related
Access :: Connection With Database Error - Invalid Connection String Attribute
I have what I think is a stupid problem with writing something to my database; can someone tell me what I'm doing wrong?

The Error: Invalid authorization specification Invalid connection string attribute





Posted: Oct 27, 2009 03:44 PM

View 3 Replies!   View Related
Making Connection Class Or Connection String In Web.config?
I ampreparing for an Access2007 db conversion at the beginning of the year and would like to know what thebest process would be for connecting to the sqlserver2005 database. I have read about adding the connection string to theweb.config file. Ihave also read about usingADO.NET and put the connection information into a class and not the web.config file.

I would like to hear from others as to what you have used, are using, or plan on using for a webapp (vs2010), and why so I can get an understanding.

Posted: Oct 18, 2010 03:19 AM

View 3 Replies!   View Related
Null Reference Using .toString / Convert The Object ConnString (a Connection String) Into A String?
on VWD 2005 this code works fine, but on 2008 it says I haven't created an instance of the object. I want to convert the object connString (a connection string) into a string.

'This acceses the virtual directory web.config file for connection strings
'We have to convert the object to a connection string
DimrootWebConfig AsSystem.Configuration.Configuration
rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/VirtualDirec")
Dim connString
As System.Configuration.ConnectionStringSettings
connString = rootWebConfig.ConnectionStrings.ConnectionStrings("ConnectString1")
Dim strConnString
String = connString.ToString().......

Posted: Feb 13, 2010 04:41 AM

View 5 Replies!   View Related
AJAX :: Unable To Debug / Debug EditPanel.debug.js File Of HTML Editor?
I want to debugEditPanel.debug.js file of HTML Editor, but it never shows in VS 08 and Im sure it executes to that line.What I did to enable debuggingUnchecked both 2 checkboxes for disabling the debugging

Set ScriptMode="Debug"

Change following line

[ClientScriptResource("AjaxControlToolkit.HTMLEditor.EditPanel", "AjaxControlToolkit.HTMLEditor.EditPanel.js")]
[ClientScriptResource("AjaxControlToolkit.HTMLEditor.EditPanel", "AjaxControlToolkit.HTMLEditor.EditPanel.debug.js")]

Posted: Apr 13, 2010 03:36 AM

View 3 Replies!   View Related
DataSource Controls :: Can't Debug On Local Machine - Getting String Was Not Recognized As A Valid Boolean
I have a page that has been working for sometimeand now getting this error..

String was not recognized as a valid Boolean.

Im was working on a How-To document of the pages for our VP and now i cant get to page 2 to continue the document.

I have recently added 2 new radiobuttonlists(rel and relst)and im sure its one of them thats causing theissue. But sicne i cant debug not sure which one is failing. Here is my insert code and the error is occuring on theLine 376:


The fields for the radiobuttons are all setup as BIT in SQL. They all have default values of 0. They are all setup NOT TO ALLOW NULLS.


Posted: Mar 15, 2010 04:53 PM

View 2 Replies!   View Related
C# - Connection String Using?
I have an ASP.NET project which gives me the following exception if I try to run it Where should I "call" it before I can use it ?There is no global.asax in my solution

Posted: Apr 28 10 at 20:27

View 3 Replies!   View Related
ADO.NET :: Connection String And DAL?
Project 1: Web Application (.aspx/.ascx/.cs/)*
Project 2: Class Library (has one static class, Repository.cs, which is full of static methods used to put/get data to/from DB)
Project 3: Web Service (allows few of the mthods of the Repository to be used via WebService)


There will be about 10 copies of Project 1 (WebAppliation) runngin on IIS each for a seperate client.I want each copy of Project 1, and the Web Service to read/write data from/to DB via Repository only. So all 11 Projects (10 Project 1, and 1 Wb Service, will be using repository as DAL)Questions1) Where shall i put the connection strings??? because each web application will have its own connection string, i cant save it in repository. And if i keep it at the web.config of each project, then what is the best way to pass it to repository?

2) Repository.cs is a static class with all static methods, is this a good approach? Should it be static? or should i not make it static in order to allow creationof objects of Repository.cs. (this way may be i can also send connection strings to the objects
of repository, in whatever project required...???)

Posted: Dec 13, 2010 06:15 PM

View 6 Replies!   View Related
Getting Connection String Out Of App.config
I added a database to my project. When I did so an app.config file was added to my project. (Yes I know I have dangerous info in the connection string. I shall change that but for now I am messing around with test stuff.)

<?xml version="1.0" encoding="utf-8" ?>
<add name="NyStories.Properties.Settings.storyConnectionString"
connectionString="Data Source=|DataDirectory|story.sdf;Password=driver;Persist Security Info=True"
providerName="Microsoft.SqlServerCe.Client.3.5" />

I did a google search on how to get the connection string value and found. string sConn = ConfigurationSettings.AppSettings["ConnectionString"]; I am getting a warning that this is obsolete. It has been replaced by ConfigurationManager.AppSettings. Ok Fine. According to the docs, it is also in System.Confiuguration which I already have a using statement for above. But when I attempt to use it, it is not part of the assembly.

Posted: Feb 01, 2011 08:53 PM

View 4 Replies!   View Related
Access DB Connection String?
I am having trouble with an access connection string. I got this from w3schools but it is throwing up an error (generic error unfortunately as it is on a remote error). The page ran fine before I added the DB Connection string. If anyone can point out any errors,Here is the code I am using:


Posted: Aug 16, 2009 11:01 AM

View 7 Replies!   View Related
MVC :: More Than One Connection String In Web.config?
My web application has to retrieve database from more then two difference sql server.

for example, one from localhost, one from different server ip.

all firewall setting was finished, but i just dont know how to code and use it.

here is my web.config :


this defines only one database in my localhost.but i need to call different connection strings each time i need.

how do i implement this?

Posted: Feb 14, 2011 04:20 PM

View 4 Replies!   View Related
MVC 3 Connection String Without Sqlexpress
Split off from

I have the same problem here.No matter what changes I make in the connection string, in the Web.Config file, MVC3 tries always to connect to the SQLEXPRESS database that I do not have. I am running the 2008 SQL Server Standard Edition on my desktop.

How and where can I replace the reference to SQLEXPRESS by one that allows me to connect to my local database?

Posted: Mar 11, 2011 04:16 PM

View 3 Replies!   View Related
Configuration :: How Does IIS 7 Gets The Connection String
I have created a ASP.NET 4 application in VS 2010usingSilverlight and RIA Services.

After finishing the first release onmy development pc, I'mstarting some deployment testing in a serverin my local network.

After sucessfully published the web applicationusing theVisual Studio FTP publishing option, I notice two strange things:

1 - On the IIS properties of the website I have uploaded my files to, you can seenow a connection string,named asLocalSqlServer that points to the aspnetdb.mdf database file. I had a look in the web.config file and I could not find this connection strind defined there. So, where is itlocated? Where did IIs got it from?

2 - As the aspnetdb.mdf file is not deployed withtin the web application and I a musing SQL express in my testing server, wherecan I drop the mdf and ldf files so they can be attached when the applicaiton runs? I know I can perform an attach operation using management studio,but I'm wandering where istheDataDirectory folder ASP.NET looks for to attachit at runtime?

Posted: Jun 17, 2010 06:18 PM

View 4 Replies!   View Related
How To Use The Connection String In The Classes
I have some classes that take the connection string from the webconfig file.

but when i use them, i got the error:

"O formato da seqüência de inicialização não está de acordo com a especificação iniciada no índice 0."

ill try to translate:

" The inicialization sequence formatdon't match with the started specification in index 0."

This is my code:


The error points to the line "Conexao = new SqlConnection(StrConexao.ToString());"

Posted: Dec 15, 2009 10:24 AM

View 5 Replies!   View Related
Connection String Has Not Been Initialized
I am getting this error:

"Connection String has not been initialized"

To give you some background, I have the following:



MyClass.vb - Contains business logic, and SQL commands that are executed.

DataAccessClass.vb - Class that handles all database related operations Basically, when I invoke a Public Shared function from MyClass.vb, sometimes it would work. On other occassions, it just would not work.

I am getting the connection string value from a webservice. When my page loads, the web service is checked and the connection string value is retrieved.

MyClass.vb will then invoke a function which would run an SQL command, use the data access class and get the value back to MyClass.


If IsNothing(ConnectionString) then
'Get the connectionstring value again from the web service.
If String.IsNullOrEmpty(ConnectionString) then
'Get the connectionstring value again from the web service.
End If
End If

'data access is executed here....

Am not sure whether the connection string is the one actually failing or another reason why.

But basically, I would not be able to execute a database operation when my connection string is Nothing (or the value is string.empty.

Posted: Nov 27, 2008 10:32 AM

View 4 Replies!   View Related
Get Values From Connection String
i have a sql connection string being stored in the web.config.

how can i pull items liek server name, username, password... insode of c# code?

Posted: Sep 20 10 at 22:45

View 4 Replies!   View Related
SQL Server Connection String?
total noob question here. I'm toying around with Silverlight, and need to connect to a database. When I connect in server explorer (VS 2010) it works fine, because it's using my windows account to authenticate. However, when I start debugging the server side stuff is running on a different account (NT-SERVICE or something to that effect) which has no privileges on the SQL server. I've tried embedding my username/password like this:

connectionString="Data Source=.;Initial Catalog={DATABASE};Integrated Security=True;User={DOMAIN}{USERNAME};Password={redacted}"

but it doesn't seem to be working. I keep getting an error:The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

Posted: Mar 10 at 18:58

View 2 Replies!   View Related
C# - Use The Same Connection String When Using NHibernate?
I have just re-implemented an ASP.NET web application that uses NHibernate to use a session per request (using an IHttpModule). The SessionFactory is created at the start of the application using a connection string from the web.config file. The SessionFactory is then stored and sessions created and released using a thread-safe, lazy singleton.

This means that if say 20 users are using the application the same user (as specified in the connection string in web.config) is used when creating any connections to the database - is this best practice? Will SQL Server Express complain about the number of connections eventually? (as connections are created and released per request this may not be a concern in practice).

In my old architecture a connection was created using the user name of the current user - is there any advantage to this (perhaps if there is are security restrictions for the logins of each different user).

When using a thread-safe, lazy singleton (like below) which contains the SessionFactory and manages sessions, I believe this is available site wide wide e.g. 2 users accessing the application from different PCs will use the same instance?

public static NHibernateSessionManager Instance
return Nested.NHibernateSessionManager;
private class Nested
static Nested() { }
internal static readonly NHibernateSessionManager NHibernateSessionManager =
new NHibernateSessionManager();

Posted: Feb 15 10 at 16:33

View 2 Replies!   View Related
Connection String Interface?
Does anyone have an example of a form where a user can enter the server name, pwd, database and it would construct the connection string and test it out?

Posted: Oct 10, 2009 09:13 PM

View 3 Replies!   View Related
ADO.NET :: Change Connection String Of EDM?
I have a entity data model generated from a database schema. Now that database is no more physically available, I want to generate a new database with the same schema model. I'm able to generate the tables from the script that the Entity Frame work generates for me.

I have two problems. I'm not able to generate the stored procedures from EDM. Second, I'm not able to change the connection string to the new database. Do I have to re-generate the edm from the new database that I'm trying to create?

Posted: Mar 22, 2011 10:11 AM

View 1 Replies!   View Related
Copyright 2005-08, All rights reserved