Azure Web 角色不再将 web.config 复制到角色目录
以前我们可以在角色部署过程中(从启动任务中)访问Web角色的web.config文件:(
来自servicedefinition.csdef)
<Startup>
<Task commandLine="sometask.cmd ..\..\..\web.config" executionContext="elevated" taskType="simple" />
</Startup>
现在,Azure似乎不再将web.config复制到角色目录中,因此我们无法在角色部署期间访问应用程序配置设置。
我们可以通过使用输出类型为“始终复制”的单独 .config 文件来解决此问题,但这会削弱我们利用部署配置文件(如 web.config.release 等)的能力。
web.config 文件是否仍然可用?有谁知道这种变化何时/为何发生?
非常感谢您提供任何信息。
We used to be able to access the web.config file for the Web role during the role deployment process (from the startup task):
(from servicedefinition.csdef)
<Startup>
<Task commandLine="sometask.cmd ..\..\..\web.config" executionContext="elevated" taskType="simple" />
</Startup>
Now, Azure no longer seems to copy the web.config to the role directory, so we are unable to access the application configuration settings during role deployment.
We could work around by using a separate .config file with output type="Copy always", but this defeats our ability to leverage the deployment profiles (like web.config.release, etc).
Is the web.config file still available somewhere? Does anyone know as to when/why this change took place?
Thanks much for any info.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想说这是去年年底 SDK 1.3 发生的一个变化。当时,Web 角色的默认行为从使用托管 Web 核心(IIS 的子集)托管 Web 应用程序更改为使用完整的 IIS。当时,Web 角色的 Web 应用程序部分已移至云中(通常)e:\sites\0(对于多个网站,则为 e:\sites\1 等)。我不知道有什么好方法来发现 web.config 的路径。
您可以简单地将 web.config 更改为“始终复制”(无需创建第二个 .config),对吧?
I would say this is a change that happened with SDK 1.3 towards the end of last year. At that time, the default behavior of a web role changed from using Hosted Web Core (a subset of IIS) to host web applications to using full IIS. The web app part of a web role was moved at that time to live in the cloud under (typically) e:\sites\0 (and e:\sites\1, etc. for multiple web sites). I don't know of a good way to discover that path to find web.config.
You could simply change web.config to be "copy always" (without creating a second .config), right?