MVC3发布策略 [英] MVC3 Release Strategy

查看:114
本文介绍了MVC3发布策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立的一个具有根据环境(开发/生产)。一些不同的配置需求小MVC3应用程序

I've built a small MVC3 Application that has some different configuration needs based upon the environment (Dev/Prod).

这主要是2方面:


  1. 版权:权利是通过Active Directory组来管理,但我的开发环境是另一个域中,然后我的生产环境:

  1. Rights: Rights are managed via Active Directory groups but my Development environment is in another domain then my Production environment:

//
// GET: /Host/Search
[Authorize(Roles = @"WIN2012\Main_v2_Read")]
public ActionResult Search()
{
    return View();
}


  • 数据库连接:在开发,集成安全是好的。对于生产服务帐户应使用:

  • Database connection: In Dev, Integrated security is fine. For production a Service Account should be used:

    < add name="MainContext" connectionString="Data Source=Main-DEV;Initial Catalog=Main;Integrated Security=True" providerName="System.Data.SqlClient" />
    


  • 我应该如何处理呢?

    推荐答案

    要使用不同的配置不同的web.config,你必须换这个配置和构建过程中,发布,部署此配置将被使用。您可以通过从配置管理器上生成菜单中的底部更改活动配置。或者从绿色箭头运行后,选择权。

    To use different web.config in different configuration you have to swap this configuration and during build, publish, deploy this configuration will be used. You can change active configuration by from configuration manager on bottom of Build menu. Or from select right after green Run arrow.

    有关web.congig转换有关数据源读取听到:

    For web.congig transformations regarding DataSource read hear:

    http://blog.discountasp.net/how-web-config-transformation-simplifies-web-deployment/

    至于问题,我会建议自授权属性,它会掉一些你的predefined角色的名字从你的code那些还web.config中保存的等效第一部分。
    这将是更容易做到,因为你可以有比环境,只是不同的web.config转型为他们每个人多。

    As for first part of question I would recommend custom Authorize attribute that will swap some your predefined roles names from your code to equivalent of those saved also in web.config. This will be easier for accomplish since you have can have more than to environments and just different web.config transformation for each of them.

    这篇关于MVC3发布策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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