.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Server specific Web.config sections replacement with WDP

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

In this post I am hoping to explain how you can change your web.config settings per different server environment using Web Deployment Projects (WDP) for VS 2005 or VS 2008�

First of all let me start with the fact that WDP for VS 2005 as well as WDP for VS 2008 are build configuration aware� In fact, special effort was made in WDP 2005 & WDP 2008 to allow configuration specific settings�

That is the reason when you look at the WDP UI you can see configuration specific dropdowns as shown below:

WDP Property Page

You can create one build configuration per your server environment eg. �Testing�, �Staging� , �Production� etc and configure all of your WDP settings per build configuration pretty easily� Learn more how to manage configurations per build environment

Next I want to change connectionStrings section in side the web.config for �Testing� server and �Release� server� The original connection String section in my web.config file looks as below:

<connectionStrings>
<add name="vishal-db" connectionString="Data Source=vijoshi-DevBox; Initial Catalog=vishal-db; Integrated Security=True"/>
</connectionStrings>








  • For �Testing� environment I would like to change my Data Source to be vijoshi-Testing


  • For �Release� environment I would like to change my Data Source to be vijoshi-Release



To accomplish this I am going to add two configuration files to my project named connectionString.Testing.config and connectionString.Release.config� After adding the two files my solution explorer should look as below:



image



The content of connectionString.Testing.config file will look as below:




<connectionStrings>
<add name="vishal-db" connectionString="Data Source=vijoshi-Testing; Initial Catalog=vishal-db; Integrated Security=True"/>
</connectionStrings>

Notice that the connectionString.Testing.config only contains connectionStrings section (as opposed to original web.config which may contain many other sections) � Similar to the above example in connectionString.Release.config file I will only change the Data Source to vijoshi-Release�


After these two files are added I can now open my WDP configuration and go to the �Deployment� node and check the �Enable Web.config file replacement��  After this the only thing I need to do is write connectionStrings=connectionString.Testing.config  as shown below�


 


connectionStrings=connectionString.Testing.config


 



After this when I build my WDP project the connectionStrings section will be replaced by the content of the connectionString.Testing.config�



Also now I can modify the Configuration from �Testing� to �Release� and set the Web.config file section replacements section to look as below



connectionStrings=connectionString.Release.config 



This way you can also modify the other config sections each in a new line of the text box shown above�



Hope this will help�



-Vishal


Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Server specific Web.config sections replacement with WDP, Diterbitkan oleh scodeaplikasi pada Senin, 12 Oktober 2009. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to