在本地应用web.config转换 [英] Applying web.config transformations locally

查看:105
本文介绍了在本地应用web.config转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对我的web.config进行了转换,如果我发布到Azure,该转换当前可以使用,但是在构建/运行时,它在本地不起作用.我该如何在本地进行发布",以便将本地转换应用于我的开发箱上的web.config?

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?

当前,我右键单击>发布到Azure,是否需要为本地框创建一个新的发布配置文件?有什么方法可以使转换在Build上运行?

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?

推荐答案

这取决于您使用的开发服务器.正如@Citronas在此答案中所说:

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

这取决于调试方式.如果您使用的是卡西尼(Cassini),请使用afaik 无论选择何种解决方案,都会读取web.config内容 配置(例如,调试或发布).

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).

如果您要调试 本地IIS,这取决于您在IIS中设置的路径.如果 您已将其设置到您的源代码目录中,需要编写您的 本地设置进入您的web.config.如果您将代码发布到 本地目录并相应地设置IIS路径,可以使用 web.config转换. (您说过,您的web.config转换是 工作)

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)

您不必在本地发布(即使您可以这样做,也可以发布到本地IIS,然后将调试器附加到应用程序池的工作进程中),因为这很烦人.最简单的方法是简单地将调试设置存储在web.config文件中,然后对可发布"的广告资源应用转换环境.

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.

简而言之:请勿将转换用于调试,而仅用于发布.使用常规的web.config进行调试.

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

这篇关于在本地应用web.config转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆