Re: Deployment in 2.0 - How To Not Overwrite web.config

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



re:
> An "Exclude web.config" checkbox would have been all that was necessary.

Doesn't selecting web.config in the Solution Explorer, and then going to the
menu "Website", and then clicking on "Exclude from project" work for you ?

What I would do, though, is include *all* connection strings in web.config and,
depending on the website's location, use the appropiate one.

Something like (pseudocode ) :

Dim dnsname As String = Request.Url.Host
If dnsname = domain1 Then
' request connection string 1 here
Elseif dnsname = domain2 Then
' request connection string 2 here
Else
' request connection string 3 here
End If
End If


That should take care of all your problems.




Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Robert" <robertv@xxxxxxxxxxxxxx> wrote in message
news:6C98466E-ACDB-40D2-BFA8-982B4BFA8AC4@xxxxxxxxxxxxxxxx
>I have what I think should be a pretty common scenario in a corporate
> environment. I have a web app and three environments on three servers:
> Development, QA and Production.
>
> We develop in development and then deploy the updated application to our QA
> server and then once tested to our production server.
>
> The application has a web.config file. The contents of the file
> (appsettings part) are different in all three environments because each
> enviroment connects to different databases (a dev, qa and the prod database).
>
> what I'm discovering is that the Publish option in VS2005 won't work in this
> scenario because it will copy web.config from development to QA or production
> and thus result in the incorrect appsettings...i.e. Production all of a
> sudden connecting to the development database.
>
> Is there any way around this with the Publish command? Or do i have to
> manually use "Copy Web" which is more timeconsuming?
>
> Excluding web.config does't work because the web.config in the destination
> is still wiped out. I tried setting web.config to Read ONly in QA and
> production but it is still deleted and overwritten by the one from dev.
>
> Seems like someone really didn't think of this common scenario. An "Exclude
> web.config" checkbox would have been all that was necessary. Or is this
> hidden somewhere?
>
> Thx.
> R-


.



Relevant Pages

  • Re: Deployment in 2.0 - How To Not Overwrite web.config
    ... > could be identical in each environment i would still need to have a way to ... providing the correct connection string to all of them. ... i may not be allowed to know the production database ... If you are tasked with developing a production site, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Deploy without overwriting Web.Config
    ... production web.config and change the connection string to the correct one ... Now I want my customer to keep their sql server ... web.config each time I make an update to the app. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: if statement in web.config file
    ... use application logic in the code to determine which connection string ... You can't put the logic directly in the .config file, ... uses a test one in production for a month before anyone notices) or put the ... logic in your app code. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Deploy without overwriting Web.Config
    ... I develop my application on my dev server and then I deploy it to a ... customer's production server. ... I store the db connection string in web.config ... When I deploy I have to open the production ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to limit access to production data from non-production code?
    ... Have separate development and production ... > Never mix development, test and production environments. ... I returned to the task in hand, deleting the database for the next task. ... underway, and the recovery time was bearable, the most recent backup was ...
    (comp.os.vms)