when 1 creates mvc project using the built-in templates (file -> new project etc) web.config reads
<compilation debug="true" targetframework="4.5" />
inside web.release.config see transform
<compilation xdt:transform="removeattributes(debug)" />
so assuming when build in release mode debug="true" disappear. not seeing this. transform applied when publishing website? i've seen websites deployed drag & drop, web.config copied on root (with debug="true" included).
i'd check, if deploying via drag & drop have remove attribute manually? or missing something?
preferred publish web-site (different f5
or drag , drop
) update\transform web.config ...
disable debug mode
depends on build configuration rather destination environment, debug attribute release build when typically want debugging disabled regardless of environment deploying to.
visual studio project templates create web.release.config transform file code removes debug attribute compilation element.
below default web.release.config: (with sample transformation code commented out, includes code in compilation element removes debug attribute:)
<?xml version="1.0" encoding="utf-8"?> <!-- more information on using web.config transformation visit http://go.microsoft.com/fwlink/?linkid=125889 --> <configuration xmlns:xdt="http://schemas.microsoft.com/xml-document-transform"> <!-- in example below, "setattributes" transform change value of "connectionstring" use "releasesqlserver" when "match" locator finds attribute "name" has value of "mydb". <connectionstrings> <add name="mydb" 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)" /> <!-- in example below, "replace" transform replace entire <customerrors> section of web.config file. note because there 1 customerrors section under <system.web> node, there no need use "xdt:locator" attribute. <customerrors defaultredirect="genericerror.htm" mode="remoteonly" xdt:transform="replace"> <error statuscode="500" redirect="internalerror.htm"/> </customerrors> --> </system.web> </configuration>
Comments
Post a Comment