C# - Managing A Debug And Release Connection String
Mar 4, 2010
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.
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.
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.
I have tried many different configuration but obviously there is something I do not understand.
These are 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 ewrepos eleaseinRXWeb.dll" /> The web.config for the debug-application looks like this: <?xml version="1.0" encoding="UTF-8"?> <configuration>............
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". Then I 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 another debugger attatched to the process.
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 file under bin/debug in 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?
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?
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?
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?
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.
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 am preparing for an Access2007 db conversion at the beginning of the year and would like to know what the best process would be for connecting to the sqlserver2005 database. I have read about adding the connection string to the web.config file. I have also read about using ADO.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.
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 Dim rootWebConfig As System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/VirtualDirec") Dim connString As System.Configuration.ConnectionStringSettings connString = rootWebConfig.ConnectionStrings.ConnectionStrings("ConnectString1") Dim strConnString As String = connString.ToString().......
I want to debug EditPanel.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
Change following line
[ClientScriptResource("AjaxControlToolkit.HTMLEditor.EditPanel", "AjaxControlToolkit.HTMLEditor.EditPanel.js")] to [ClientScriptResource("AjaxControlToolkit.HTMLEditor.EditPanel", "AjaxControlToolkit.HTMLEditor.EditPanel.debug.js")]
I have a page that has been working for sometime and 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 the issue. But sicne i cant debug not sure which one is failing. Here is my insert code and the error is occuring on the Line 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.
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...???)
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.)
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.
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: