简体   繁体   English

Webconfig转换文件

[英]Webconfig transformation files

We start to use Web Config transformation files but we figured out that only works when publishes your application on each environment, we thought the transformation files are to change the connection strings and webservice endpoints when starts to debug your app, currently we have to change the connection string and webservice endpoints manually. 我们开始使用Web Config转换文件,但我们发现只有在每种环境上发布您的应用程序时,它才有效,我们认为转换文件将在开始调试您的应用程序时更改连接字符串和Web服务端点,目前,我们必须更改连接字符串和webservice端点。 We are right or there is a way to take advantage of transformation files to change connection strings and web service endpoints automatically according selected configuration file? 我们是对的还是有办法利用转换文件来根据所选的配置文件自动更改连接字符串和Web服务端点?


Until now we know that transformation files just works for publish your app on each environment, but I'd like to know if there is a way to take advantage of transformation files as developer, for example: Imagine that testing team detects a bug, now developers have to replicate the error in development environment, then they have to change the connection string and web services endpoints manually to point to testing environment and replicate the error too. 到目前为止,我们知道转换文件仅适用于在每种环境下发布您的应用程序,但是我想知道是否有一种方法可以利用转换文件作为开发人员,例如:假设测试团队现在检测到一个错误。开发人员必须在开发环境中复制错误,然后他们必须手动更改连接字符串和Web服务端点以指向测试环境并复制错误。 As developer I'd like to avoid change connection string and endpoints webservices manually. 作为开发人员,我希望避免手动更改连接字符串和端点Web服务。 I thought just switching between transformation files I could achieve it but no, because If we select Debug and run the application, it points to the development environment, then if we select Testing and run the application, it still pointing to the Development environment. 我以为只是在转换文件之间切换就可以实现,但是没有实现,因为如果选择“调试”并运行该应用程序,则它指向开发环境,然后,如果选择“测试”并运行该应用程序,则它仍指向开发环境。

How can we achieve to point to the correct environment or is there another way to do it? 我们如何实现指向正确的环境,或者还有另一种方法来做到这一点?

Use the settings you want for your debugging in the web.config. 在web.config中使用调试所需的设置。 If you want to use release settings, publish and use web config transforms 如果要使用发布设置,请发布并使用Web配置转换

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM