473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Implement Connections from machine.config

I have two application running in one server, both have same
sqlserver connection strings in their web.config files. i want to
combine both connection strings in one config file.
please suggest me, can i implement those connection strings in
machine.config file and use connections from their.

i have tried it, but unable to implement

Please help.

Thanks,

Jul 3 '08 #1
3 1449
First - I'm assuming you are using .NET 2.0 or higher; with 1.1 all
bets are off...

The simplest option is just to duplicate the connection strings
between apps; this means you can simply "robocopy" the site to a new
server and it will work - but I appreciate that this might complicate
configuration (even with an automated configuration/deployment
process, you might need to change the keys post-deployment to cope
with server changes - and it is nice to do this in one centralised
place).

The machine.config should already include this, with the
"LocalSqlServer" default. Adding extras to here should work fine as
long as you don't have a <clear/element at any level. You should be
able to do the same in the master web.config if it is running ASP.NET;
another option for ASP.NET is to have a web.config in the site root
with the necessary options, but some entries in here will break things
if you have any legacy ASP.NET 1.1 sites (since they will attempt to
parse the same root web.config). You can get around this if you need
(using the "location" element).

Note that editing the machine.config or the master web.config (without
using "location") is not recommended if you are hosting isolated sites/
apps that shouldn't know about eachother, as these keys will leak
information between sites - but as long as your apps are all under
your control it should be OK.

Marc
Jul 3 '08 #2

"Girish" wrote:
I have two application running in one server, both have same
sqlserver connection strings in their web.config files. i want to
combine both connection strings in one config file.
please suggest me, can i implement those connection strings in
machine.config file and use connections from their.

i have tried it, but unable to implement

Please help.

Thanks,
Hi Girish,

Yes, you can set common connectionstrings in Machine.Config

In fact, I found one there already, accessible to both windows and web
applications

ConnectionStringSettings conn =
ConfigurationManager.ConnectionStrings["LocalSqlServer"];

Remember to put it on the configuration level

<configuration>
<connectionStrings>
<add name="LocalSqlServer" connectionString="..."
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>

--
Happy Coding!
Morten Wennevik [C# MVP]

Jul 3 '08 #3
Hi Girish,

machine.config impacts on all applications and conflicts there might ruin
everyones. So, how about to implement configuration providing service holds
information about environments? Take a look on UDDI concepts.

Regards, Alex Meleta
mailto:am*****@gmail.com; blog:devkids.blogspot.com
I have two application running in one server, both have same
sqlserver connection strings in their web.config files. i want to
combine both connection strings in one config file.
please suggest me, can i implement those connection strings in
machine.config file and use connections from their.
i have tried it, but unable to implement

Please help.

Thanks,

Jul 3 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
3
by: Raghu Rudra | last post by:
By default, the machine.config contains following information: <system.net> ....... <connectionManagement> <add address="*" maxconnection="2"/> </connectionManagement> </system.net> This...
4
by: Matt Anderson | last post by:
When I use Xcopy to deploy my changes to IIS, it seems to drop the user connections; i.e., empties out their Session variables, etc. I thought ASP.NET was supposed to use shadow deployment and...
9
by: stephen | last post by:
Hello, I am using ASP.NET as a streaming engine for mp3 and ogg files over HTTP. Basically, the asp.net page sets it's mime content type to audio/mp3 and i write out the file to the stream. We will...
6
by: Fredrik Arenhag | last post by:
Hi! I'm in the process of developing an application for downloading files from a webserver. This is done in a threaded manner, but how hard I ever try I can't seem to manage to get more than 2...
6
by: TulasiKumar | last post by:
hi all, i have one requirement in my project.The requirement is i want to fix some domain sites in TcpIp like proxy servers behaviour.When ever end user passing the inforamtion of that domain...
11
by: TARUN | last post by:
Hello All I need to ask about the configuration file in .NET, There are Two config File 1. Web Config 2. Machine config I understand the the usage of Web config , but not able to understand...
5
by: jacques.steward | last post by:
I have an application that kicks off a long process on the database server with a separate thread and then forwards the user to another page which monitors the progress of this process by reading a...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.