在部署时没有看到的app.config联合Azure的Web角色和辅助角色项目 [英] Combined Azure web role and worker role project not seeing app.config when deployed

查看:128
本文介绍了在部署时没有看到的app.config联合Azure的Web角色和辅助角色项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实施联合网/辅助角色场景描述<一个href=\"http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/how-to-combine-worker-and-web-role-in.html\">here在那里你只需添加以下到你的Worker角色:

I'm implementing the combined web/worker role scenario as described here where you simply add the following to your worker role:

public override void Run()
{
    // This is a sample worker implementation. Replace with your logic.
    Trace.WriteLine("WorkerRole1 entry point called", "Information");
    while (true)
    {
        Thread.Sleep(10000);
        Trace.WriteLine("Working", "Information");
    }
}

问题,在这篇文章的评论指出,是这工作进程读取倾斜web.config文件,所以你需要添加一个app.config。它还要指出的是的app.config不会被自动部署

The problem, as noted in the post's comments, is that this worker process cant read web.config so you have to add an app.config. It is also noted that app.config does not get deployed automatically.

我的问题是如何配置我的项目,所以的app.config将得到部署?

我添加的app.config到我的项目,设置生成操作为内容和始终复制

I've added app.config to my project, set the Build Action to "Content", and "Copy always"

这工作正常,在模拟器中,而不是在部署到Azure上。

THIS WORKS FINE IN THE EMULATOR, but not when deployed to Azure.

请注意:我注意到在projectname.dll.config创建仿真器,而不是在部署到Azure上。
我使用VS2010中,Windows Azure工具2011

Note: I noticed in the emulator a projectname.dll.config is created, but not when deployed to Azure. I'm using VS2010, Windows Azure Tools 2011

我知道有些人会建议使用.cscfg文件,而不是,但我的许多部件得到的web.config / app.config中的设置:
ELMAH,瞬态故障处理客户端,诊断,电子邮件等...

I know some will suggest using the .cscfg file instead, but many of my components get their settings from web.config/app.config: Elmah, Transient Fault Handling Client, Diagnostics, Email, etc...

推荐答案

请详细阅读<一href=\"http://blogs.msdn.com/b/windowsazure/archive/2010/12/02/new-full-iis-capabilities-differences-from-hosted-web-core.aspx\"相对=nofollow>这个博客帖子。它解释很详细的是什么在完整的IIS的Windows Azure Web角色发生了。

Please read thoroughly this blog post. It explains in great details what is happening in Windows Azure Web Role with Full IIS.

您需要做的,就是增加一个 WaIISHost.exe.config 文件(复印件输出=拷贝总是)。并把你在该文件中所需要的所有配置。这是因为,你的code(RoleEntryPoint)住在WaIISHost.exe的过程,而不是你的pdojectName.dll过程。

What you need to do, is to add a WaIISHost.exe.config file (with copy to output = copy always). And put all the configurations you need in that file. This is because, your code (RoleEntryPoint) lives in WaIISHost.exe process, and not your pdojectName.dll process.

这篇关于在部署时没有看到的app.config联合Azure的Web角色和辅助角色项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆