[英]Getting the WebRole module inside my Azure web role app to read web.config settings
I understand that the WebRole module inside my Web Role web app project runs inside WAIISHost.exe and the rest of the app runs inside W3WP.EXE. 我了解我的Web角色Web应用程序项目中的WebRole模块在WAIISHost.exe中运行,而该应用程序的其余部分在W3WP.EXE中运行。 Therefore web.config settings cannot be read from the WebRole app domain.
因此,无法从WebRole应用程序域读取web.config设置。
This can be solved by creating a special "waiishost.exe.config" in the web project file and set the "Copy to Output Directory" property to "Copy Always". 这可以通过在Web项目文件中创建特殊的“ waiishost.exe.config”并将“复制到输出目录”属性设置为“始终复制”来解决。
That's fine. 没关系。 However, now, I have config settings in ServiceConfiguration AND web.config AND "waiishost.exe.config".
但是,现在,我在ServiceConfiguration AND web.config和“ waiishost.exe.config”中有了配置设置。 This is only a minor but annoying issue though.
虽然这只是一个小问题,但很烦人。 The biggest problem is that when I publish my Azure project, ServiceConfiguration and web.config get automatically transformed into the production values whereas waiishost.exe.config does not get transformed, so I end up with development config going into the production environment.
最大的问题是,当我发表我的Azure项目,ServiceConfiguration和web.config文件都会自动转化为生产值,而waiishost.exe.config没有得到改变,所以我最终开发配置进入生产环境。 (the production env is not live yet, so not a major issue yet )
(生产ENV不活还,所以不是一个主要的问题还 )
Can anyone think of any ideas as to how I can also have the Publish process transform waiishost.exe.config? 任何人都可以想到关于如何也可以使发布过程转换waiishost.exe.config的任何想法吗? Maybe I could run some kind of startup process which could simply copy and rename the web.config file to be waiishost.exe.config before waiishost.exe starts.
也许我可以运行某种启动过程,可以在 waiishost.exe启动之前简单地将web.config文件复制并重命名为waiishost.exe.config。
BTW, I cannot simply move config to the ServiceConfiguration file as I have whole config sections and connection strings which are used by third party components, like the ServiceBusConfiguration section. 顺便说一句,我不能简单地将配置移到ServiceConfiguration文件,因为我拥有整个配置节和第三方组件使用的连接字符串,例如ServiceBusConfiguration节。
Many thanks 非常感谢
Yes, there is. 就在这里。
A little manual, but is "one-time-setup" per project. 有点手册,但是每个项目都是“一次性设置”。 Check out this and that blog posts I've made a while ago (even before you could have ServiceConfiguration files).
看看这个和那个 ,我前一阵子做博客文章(甚至之前你可以有ServiceConfiguration文件)。 These blog posts will give you a great idea on how to achieve your desire.
这些博客文章将使您对如何实现自己的愿望有个好主意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.