Applying web.config transformations locally

爷,独闯天下 提交于 2019-12-30 18:50:14

问题


I have a transform for my web.config that currently works if I publish to Azure, but it's not working locally when I build/run. How can I go about "Publishing" locally so the Local transformations are applied to my web.config on my dev box?

Currently I right-click > publish to Azure, do I need to create a new publish profile for my local box? Is there any way to get the transforms to work on Build instead?


回答1:


It depends on which dev server you are using. As @Citronas said on this answer:

It depends on how you debug. If you are using Cassini, afaik your web.config contents will be read regardless of the selected solution configuration (e.g. Debug or Release).

If you are debugging with your local IIS, it depends on what you have set the path in the IIS to. If you have set it to your source code directory, you need to write your local settings into your web.config. If you publish your code into a local directory and set the IIS path accordingly, you can use web.config transforms. (You said, that your web.config transforms are working)

You do not need to publish locally (even though you can do that, publish to local IIS then attach the debugger to the worker process of the application pool) since it is annoying. The easiest way is to simple have your debug settings in the web.config file and then apply transforms for your "publishable" environments.

In short: do not use transforms for debug, only for publishing. Use the regular web.config to debug.



来源:https://stackoverflow.com/questions/19301002/applying-web-config-transformations-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!