简体   繁体   中英

Azure web role no longer copies web.config to role directory

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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