Home
%3CLINGO-SUB%20id%3D%22lingo-sub-343067%22%20slang%3D%22en-US%22%3EWeb%20Deployment%20through%20Visual%20Studio%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343067%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EThis%20blog%20explains%20the%202%20different%20ways%20of%20deploying%20the%20web%20application%20to%20the%20IIS%20server.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EWe%20often%20come%20across%20the%20scenarios%20where%20in%20the%20application's%20web.config%20need%20to%20have%20different%20settings%20when%20it%20is%20deployed%20from%20one%20environment%20to%20the%20other%20(Example%3A%20From%20development%20to%20staging%20or%20production).%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EWe%20can%20use%20either%20of%20the%20below%20technique%20to%20automate%20the%20process%20of%20changing%20web.config%20during%20deployment%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23000025%22%20size%3D%222%22%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EUsing%20Web.config%20transformation%20technique%26nbsp%3B%20%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23000025%22%20size%3D%222%22%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EUsing%20the%20Deploy%20Parameters%20%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EBelow%20is%20the%20list%20of%20a%20few%20settings%20which%20we%20tend%20to%20change%20while%20deploying%20application%20from%20one%20environment%20to%20the%20other%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EappSettings%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EconnectionStrings%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3Edebug%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EcustomErrors%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ErunAllManagedModulesForAllRequests%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%20text-decoration%3A%20underline%3B%22%3E%3CSTRONG%3EWeb.config%20tranformation%3A%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EThis%20technique%20specifies%20how%20the%20web.config%20file%20should%20be%20changed%20based%20on%20the%20specific%20build%20configurations%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EDebug%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ERelease%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ECustom%20build%20configurations.%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%232a2a2a%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EThe%20web.config%20of%20the%20above%20build%20configuration%20makes%20use%20of%20the%20%3CSTRONG%3EXML-Document-Transform%20%3C%2FSTRONG%3Enamespace%20defines%20two%20attributes%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%232a2a2a%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3ELocator%3A%3C%2FSTRONG%3E%20This%20attribute%20specifies%20the%20web.config%20element%20or%20set%20of%20elements%20that%20you%20want%20to%20change%20in%20some%20way.%20%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%232a2a2a%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3ETransform%3A%20%3C%2FSTRONG%3EThis%20attribute%20specifies%20what%20you%20want%20to%20do%20to%20the%20elements%20that%20%3CSTRONG%3ELocator%20%3C%2FSTRONG%3Eattribute%20finds.%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ETo%20achieve%20the%20above%20requirements%20using%20the%20%3CSTRONG%3Eweb.config%20transformation%3C%2FSTRONG%3E%20technique%2C%20we%20need%20to%20follow%20the%20below%20steps%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ERight%20Click%20on%20the%20Application%20in%20Visual%20Studio%20and%20click%20on%20%3CSTRONG%3EProperties.%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ESelect%20the%20appropriate%20%3CSTRONG%3EBuild%20configuration%3C%2FSTRONG%3E%20and%20the%20path%20where%20you%20would%20like%20the%20zip%20file%20to%20be%20created.%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EIn%20this%20scenario%20we%20have%20selected%20the%20configuration%20as%20Release.%20So%20the%20default%20location%20where%20the%20zip%20file%20will%20be%20created%20is%20application%20relative%20path%20%3CSTRONG%3EObj%5CRelease%5CPackage%5C.%3C%2FSTRONG%3E%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22text-align%3A%20center%3B%22%3E%3CIMG%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FMSDNBlogsFS%2Fprod.evol.blogs.msdn.com%2FCommunityServer.Blogs.Components.WeblogFiles%2F00%2F00%2F00%2F99%2F06%2Fmetablogapi%2F3312.050215_1458_WebDeployme1.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EBelow%20is%20the%20sample%20content%20placed%20in%20the%20web.Release.config%20which%20will%20achieve%20the%20requirement%3A%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EappSettings%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eadd%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Ekey%3D%22Title%22%20value%3D%22Titletest%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Exdt%3ATransform%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3ESetAttributes%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20xdt%3ALocator%3D%22Match(key)%22%20%2F%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BappSettings%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EconnectionStrings%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eadd%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Ename%3D%22testConnectionString%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3EconnectionString%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3EData%20Source%3DReleaseSQLServer%3BInitial%20Catalog%3DMyReleaseDB%3BIntegrated%20Security%3DTrue%3C%2FSPAN%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Exdt%3ATransform%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3ESetAttributes%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20xdt%3ALocator%3D%22Match(name)%22%2F%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BconnectionStrings%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Esystem.web%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Ecompilation%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Exdt%3ATransform%3D%22RemoveAttributes(debug)%22%20%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EcustomErrors%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Emode%3D%22On%22%20defaultRedirect%3D%22GenericError.htm%22%20xdt%3ATransform%3D%22Replace%22%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eerror%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3EstatusCode%3D%22500%22%20redirect%3D%22InternalError.htm%22%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BcustomErrors%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bsystem.web%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Esystem.webServer%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Emodules%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Exdt%3ATransform%3D%22SetAttributes%22%20runAllManagedModulesForAllRequests%3D%22false%22%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EIf%20You%20are%20using%20Visual%20Studio%202010%20then%2C%20Right%20click%20on%20the%20application%20and%20select%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3E%3CA%20name%3D%22Build%22%20target%3D%22_blank%22%3E%3C%2FA%3EBuild%20Deployment%20Package%3C%2FSTRONG%3E%3A%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22text-align%3A%20center%3B%22%3E%3CIMG%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FMSDNBlogsFS%2Fprod.evol.blogs.msdn.com%2FCommunityServer.Blogs.Components.WeblogFiles%2F00%2F00%2F00%2F99%2F06%2Fmetablogapi%2F6406.050215_1458_WebDeployme2.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-size%3A%2012pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%22%3EOn%20Visual%20Studio%202012%20and%20above%20You%20can%20go%20to%20Build-%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Wingdings%3B%22%3E%C3%A0%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%22%3EPublish%20Selection%20and%20select%20the%20below%20setting%3A%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20center%3B%22%3E%3CIMG%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FMSDNBlogsFS%2Fprod.evol.blogs.msdn.com%2FCommunityServer.Blogs.Components.WeblogFiles%2F00%2F00%2F00%2F99%2F06%2Fmetablogapi%2F1513.050215_1458_WebDeployme3.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EOnce%20the%20.zip%20package%20gets%20created%20in%20the%20above%20mentioned%20location%2C%20You%20can%20either%20move%20the%20package%20manually%20to%20the%20destination%20server%20and%20import%20it%20using%20the%20IIS%20GUI%20(shown%20below)%20%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3E%3CSTRONG%3Eor%3C%2FSTRONG%3E%3C%2FSPAN%3E%20use%20the%20web%20deploy%20and%20option%20in%20Visual%20studio%20and%20publish%20it%20directly.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3EWeb%20Deploy%20parameters%3A%3C%2FSTRONG%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EThis%20technique%20is%20useful%20when%20you%20have%20to%20create%20a%20package%20when%20you%20do%20not%20know%20what%20values%20need%20to%20be%20set%20until%20you%20deploy%20the%20application%20to%20the%20different%20environment.%20Moreover%20this%20technique%20also%20helps%20when%20the%20same%20application%20(package%20.zip%20file)%20needs%20to%20be%20placed%20in%20different%20environments%20with%20different%20values.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ETo%20achieve%20the%20above%20requirements%20using%20the%20%3CSTRONG%3EWeb%20Deploy%20parameters%3C%2FSTRONG%3E%20technique%2C%20we%20need%20to%20follow%20the%20below%20steps%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3ECreate%20a%20file%20named%20%3CSTRONG%3Eparameters.xml%20%3C%2FSTRONG%3Eand%20save%20it%20in%20the%20projects%20folder.%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%23222222%3B%22%3EUnder%20the%20File%20Properties%20of%20%3CSTRONG%3Eparameters.xml%20%3C%2FSTRONG%3Eset%20the%20Build%20Action%20to%20%3CSTRONG%3ENone.%20%3C%2FSTRONG%3E%3C%2FSPAN%3EThis%20way%20the%20parameters.xml%20file%20would%20not%20be%20copied%20along%20with%20the%20web%20site%20contents.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EBuild%20the%20deployment%20package%20using%20the%20steps%20mentioned%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fwebtopics%2F2015%2F05%2F02%2Fweb-deployment-through-visual-studio%2F%23Build%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EThe%20package%20(.zip)%20file%20will%20be%20generated%20in%20the%20specified%20location.%20You%20will%20also%20find%20%22SetParameters.xml%22%20file%20which%20can%20be%20modified%20with%20required%20parameters%20(values)%20before%20deploying%20them%20to%20the%20destination%20server.%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CDIV%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EFinally%20execute%20the%20below%20to%20deploy%20the%20application.%20Alternatively%20you%20may%20use%20the%20%22deploy.cmd%22%20file%20to%20deploy%20the%20package%20to%20destination%20server.%20%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EYou%20can%20also%20import%20the%20package%20using%20the%20msdeploy%20command%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3Emsdeploy.exe%20-source%3Apackage%3D'C%3A%5CWebDeploy_Demo.zip'%20-dest%3Aauto%2CcomputerName%3D'%26lt%3B%3CEM%3Edestination%20server%3C%2FEM%3E%26gt%3B'%2CincludeAcls%3D'False'%20-verb%3Async%20-disableLink%3AAppPoolExtension%20-disableLink%3AContentExtension%20-disableLink%3ACertificateExtension%20-setParamFile%3A%22C%3A%5CWebDeploy_Demo.SetParameters.xml%22%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%232a2a2a%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EIf%20you%20use%20IIS%20Manager%20to%20import%20the%20package%20from%20the%20IIS%20GUI%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20center%3B%22%3E%3CIMG%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FMSDNBlogsFS%2Fprod.evol.blogs.msdn.com%2FCommunityServer.Blogs.Components.WeblogFiles%2F00%2F00%2F00%2F99%2F06%2Fmetablogapi%2F5280.050215_1458_WebDeployme4.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20%232a2a2a%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EOnce%20imported%20you%20are%20prompted%20to%20enter%20a%20value%20for%20the%20parameter%20in%20the%20%3CSTRONG%3EEnter%20Application%20Package%20Information%20%3C%2FSTRONG%3Edialog%20box.%20The%20dialog%20box%20displays%20the%20name%2C%20description%2C%20and%20default%20value%20that%20you%20specified%2C%20as%20shown%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20center%3B%22%3E%3CIMG%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FMSDNBlogsFS%2Fprod.evol.blogs.msdn.com%2FCommunityServer.Blogs.Components.WeblogFiles%2F00%2F00%2F00%2F99%2F06%2Fmetablogapi%2F6866.050215_1458_WebDeployme5.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%23222222%3B%20font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3EBelow%20is%20the%20sample%20content%20placed%20in%20the%20%3CSTRONG%3Eparameters.xml%20%3C%2FSTRONG%3Ewhich%20will%20achieve%20the%20requirement%3A%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Exml%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Eversion%3D%221.0%22%20encoding%3D%22utf-8%22%20%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eparameters%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eparameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Ename%3D%22connectionstring%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20description%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3EChanging%20the%20SQL%20connectionString%20to%20point%20to%20the%20production%20DB%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20defaultValue%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Edata%20source%3D.%5CSQLEXPRESS%3BIntegrated%20Security%3DSSPI%3BAttachDBFilename%3D%7CDataDirectory%7C%5Caspnetdb.mdf%3BUser%20Instance%3Dtrue%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20tags%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3ESqlConnectionString%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EparameterEntry%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Escope%3D%22%5C%5Cweb.config%24%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bmatch%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%2Fconfiguration%2FconnectionStrings%2Fadd%5B%40name%3D'mstestConnectionString1'%5D%2F%40connectionString%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%2F%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20parameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eparameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Ename%3D%22appsettings%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20description%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3EChanging%20the%20appsettings%20value%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20defaultValue%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3ETitletest%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20tags%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EparameterEntry%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20scope%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3CA%20target%3D%22_blank%22%3E%5C%5Cweb.config%24%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20match%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%2Fconfiguration%2FappSettings%2Fadd%5B%40key%3D'Title'%5D%2F%40value%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%2F%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20parameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eparameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Ename%3D%22Debug%20value%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bdescription%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3EChanging%20the%20debug%20value%20in%20web.config%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20defaultValue%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Efalse%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20tags%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EparameterEntry%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20scope%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3CA%20target%3D%22_blank%22%3E%5C%5Cweb.config%24%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20match%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3CA%3E%2Fconfiguration%2Fsystem.web%2Fcompilation%2F%40debug%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%2F%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20parameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3Eparameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%3CSPAN%20style%3D%22color%3A%20red%3B%22%3Ename%3D%22runAllManagedModulesForAllRequests%20setting%20for%20modules%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20description%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3EChange%20the%20runAllManagedModulesForAllRequests%20in%20web.config%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BdefaultValue%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Efalse%3C%2FSPAN%3E%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20tags%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%22%22%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26lt%3B%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3EparameterEntry%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20scope%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3CA%20target%3D%22_blank%22%3E%5C%5Cweb.config%24%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20red%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bmatch%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3CA%3E%2Fconfiguration%2Fsystem.webServer%2Fmodules%2F%40runAllManagedModulesForAllRequests%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%20%2F%26gt%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20parameter%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3Eparameters%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-left%3A%2036pt%3B%22%3E%3CSTRONG%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%20small%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3EAuthor%3A%20Naveen%20Baliga%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E

This blog explains the 2 different ways of deploying the web application to the IIS server.

We often come across the scenarios where in the application's web.config need to have different settings when it is deployed from one environment to the other (Example: From development to staging or production).

We can use either of the below technique to automate the process of changing web.config during deployment:

  • Using Web.config transformation technique 
  • Using the Deploy Parameters

Below is the list of a few settings which we tend to change while deploying application from one environment to the other:

  1. appSettings
  2. connectionStrings
  3. debug
  4. customErrors
  5. runAllManagedModulesForAllRequests

Web.config tranformation:

This technique specifies how the web.config file should be changed based on the specific build configurations:

  • Debug
  • Release
  • Custom build configurations. 

The web.config of the above build configuration makes use of the XML-Document-Transform namespace defines two attributes:

  • Locator: This attribute specifies the web.config element or set of elements that you want to change in some way.
  • Transform: This attribute specifies what you want to do to the elements that Locator attribute finds.

 To achieve the above requirements using the web.config transformation technique, we need to follow the below steps:

  • Right Click on the Application in Visual Studio and click on Properties.
  • Select the appropriate Build configuration and the path where you would like the zip file to be created.
  • In this scenario we have selected the configuration as Release. So the default location where the zip file will be created is application relative path Obj\Release\Package\.

  • Below is the sample content placed in the web.Release.config which will achieve the requirement:

    <appSettings>

        <add key="Title" value="Titletest"

         xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />

    </appSettings>

    <connectionStrings>

        <add name="testConnectionString"

         connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"

         xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

    </connectionStrings>

    <system.web>

        <compilation xdt:Transform="RemoveAttributes(debug)" />

        <customErrors mode="On" defaultRedirect="GenericError.htm" xdt:Transform="Replace">

            <error statusCode="500" redirect="InternalError.htm"/>

        </customErrors>

    </system.web>

    <system.webServer>

        <modules xdt:Transform="SetAttributes" runAllManagedModulesForAllRequests="false">

  • If You are using Visual Studio 2010 then, Right click on the application and selectBuild Deployment Package:

On Visual Studio 2012 and above You can go to Build-àPublish Selection and select the below setting:

 Once the .zip package gets created in the above mentioned location, You can either move the package manually to the destination server and import it using the IIS GUI (shown below) or use the web deploy and option in Visual studio and publish it directly.

 

Web Deploy parameters:

This technique is useful when you have to create a package when you do not know what values need to be set until you deploy the application to the different environment. Moreover this technique also helps when the same application (package .zip file) needs to be placed in different environments with different values.

 To achieve the above requirements using the Web Deploy parameters technique, we need to follow the below steps:

  1. Create a file named parameters.xml and save it in the projects folder.
  2. Under the File Properties of parameters.xml set the Build Action to None. This way the parameters.xml file would not be copied along with the web site contents.
  3. Build the deployment package using the steps mentioned here
  4. The package (.zip) file will be generated in the specified location. You will also find "SetParameters.xml" file which can be modified with required parameters (values) before deploying them to the destination server.
  5. Finally execute the below to deploy the application. Alternatively you may use the "deploy.cmd" file to deploy the package to destination server.

     

You can also import the package using the msdeploy command:

msdeploy.exe -source:package='C:\WebDeploy_Demo.zip' -dest:auto,computerName='<destination server>',includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\WebDeploy_Demo.SetParameters.xml"

 

If you use IIS Manager to import the package from the IIS GUI:

Once imported you are prompted to enter a value for the parameter in the Enter Application Package Information dialog box. The dialog box displays the name, description, and default value that you specified, as shown below:

 Below is the sample content placed in the parameters.xml which will achieve the requirement:

<?xml version="1.0" encoding="utf-8" >

<parameters>

      <parameter name="connectionstring"

        description="Changing the SQL connectionString to point to the production DB"

        defaultValue="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"

        tags="SqlConnectionString">

         <parameterEntry scope="\\web.config$"

         match="/configuration/connectionStrings/add[@name='mstestConnectionString1']/@connectionString" />

     </parameter>

     <parameter name="appsettings"

         description="Changing the appsettings value"

         defaultValue="Titletest"

         tags="" >

         <parameterEntry

            scope=\\web.config$

            match="/configuration/appSettings/add[@key='Title']/@value" />

     </parameter>

     <parameter name="Debug value"

         description="Changing the debug value in web.config"

         defaultValue="false"

         tags="">

         <parameterEntry

             scope=\\web.config$

             match=/configuration/system.web/compilation/@debug />

    </parameter> 

    <parameter name="runAllManagedModulesForAllRequests setting for modules"

          description="Change the runAllManagedModulesForAllRequests in web.config"

          defaultValue="false"

          tags="">

        <parameterEntry

              scope=\\web.config$

              match=/configuration/system.webServer/modules/@runAllManagedModulesForAllRequests />

     </parameter>

</parameters>

Author: Naveen Baliga