Home > Mobile >  ASP.Net cannot render the page when compilation debug is false
ASP.Net cannot render the page when compilation debug is false

Time:07-19

I have an ASP.Net project framework 4.5.2. When I set the compilation debug="true" in web.config, the page is working fine. When I set the debug="false", the page cannot be rendered. It shows special character as below:

enter image description here

Please give me the solution to fix the issue.

CodePudding user response:

My best guess? When you set debug= false? That forces the project to use the min (minimized) version of your JavaScript libraries. For example I modified some of the JavaScript routines in the ajaxtoolkit library. Debug=false never worked or saw my JavaScript changes.

So I installed a JS minimizer package. Now when I modify the JavaScript. I at that point in time also run the minimizer against that js routine and thus when you use debug=false, then your project will now be using the js.min versions of your JavaScript libraries.

Minimization is a huge topic - way way beyond a simple post and answer on SO.

However flipping debug= false does mean your now using the min version of those JavaScript libraries - and thus they must exist - so I would look and check what JavaScript libraries that page uses. You can compile the application as release, but setting debug=false also means JavaScript.min libraries will be used. So check above in regards to what JavaScript libraries that page uses (and ensure the min versions of those libraries exist before you attempt a publish)

Edit -- Also,try clearing the browser cache - all of it.

CodePudding user response:

For my case, the problem was caused by WebMarkupMin package. The page implements WebMarkupMin's MinifiedAndCompressedHtmlPage class.

  • Related