我正在尝试清理我们的web.config文件,这样每个部署的特定内容就不会保存在主配置中。我已经处理了连接字符串和一些mailSettings,但我需要from属性和configSource,但这似乎是不允许的。
目前,我有以下内容:
web.config:
<system.net>
<mailSettings >
<smtp configSource="email.config" from="me@blahblah.com" />
</mailSettings>
<defaultProxy>
<proxy bypassonlocal="True" usesystemdefault="False" />
</defaultProxy>
</system.net>email.config
<network host="myhost" password="" userName="" />理想情况下,我应该在mailSettings或system.net上设置configSource,但这不受支持。
有没有更好的方法来做这件事?
发布于 2010-01-22 17:21:12
好吧,这是我的一个误会。我不认为我能做到:
<system.net>
<mailSettings >
<smtp configSource="email.config" />
</mailSettings>
</system.net>和:
<smtp from="someone@stackoverflow.com">
<network host="myhost" password="" userName="" />
</smtp>你能做到的。希望我在公共场合的愚蠢行为能帮助其他人保持自己的尊严,而不必问愚蠢的问题。
发布于 2010-01-16 03:33:28
你必须决定:如果你使用configSource,它会赢,其他的设置会被忽略。你同时使用这两种方法的原因是什么?如果这是一个调试/发布问题,您可以使用两个不同的configSource文件,并通过构建后操作将它们复制到正确的位置。
https://stackoverflow.com/questions/2070856
复制相似问题