标签: configuration

.NET配置(app.config/web.config/settings.settings)

我有一个.NET应用程序,它具有用于Debug和Release版本的不同配置文件.例如调试app.config文件指向一个发展的SQL Server具有调试启用,并公布目标指向活的SQL Server.还有其他设置,其中一些在调试/发布中有所不同.

我目前使用两个单独的配置文件(debug.app.config和release.app.config).我在项目上有一个构建事件,它说如果这是一个发布版本,那么将release.app.config复制到app.config,否则将debug.app.config复制到app.config.

问题是应用程序似乎从settings.settings文件中获取其设置,因此我必须在Visual Studio中打开settings.settings,然后提示我设置已更改,因此我接受更改,保存settings.settings并具有重建以使其使用正确的设置.

是否有更好/推荐/首选的方法来实现类似的效果?或者同样,我接近这个完全错误并且有更好的方法吗?

.net c# vb.net asp.net configuration

161
推荐指数
8
解决办法
9万
查看次数

Nginx 403错误:禁止[文件夹]的目录索引

我有3个域名,我正在尝试使用Nginx在一台服务器(数字海洋液滴)上托管所有3个站点.

mysite1.name mysite2.name mysite3.name

其中只有一个有效.另外两个导致403错误(以相同的方式).

在我的nginx错误日志中,我看到:[error] 13108#0: *1 directory index of "/usr/share/nginx/mysite2.name/live/" is forbidden.

我的网站启用配置是:

server {
        server_name www.mysite2.name;
        return 301 $scheme://mysite2.name$request_uri;
}
server {
        server_name     mysite2.name;

        root /usr/share/nginx/mysite2.name/live/;
        index index.html index.htm index.php;

        location / {
                try_files $uri $uri/ /index.html index.php;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}
Run Code Online (Sandbox Code Playgroud)

所有3个站点都有几乎相同的配置文件.

每个站点的文件都在/usr/share/nginx/mysite1.name/someFolder等文件夹中,然后/usr/share/nginx/mysite1.name/live是一个符号链接.(与mysite2和mysite3相同.)

我看过禁止所有文件的Nginx 403,但这没有用.

关于可能出错的任何想法?

configuration nginx domain-name http-status-code-403

158
推荐指数
11
解决办法
39万
查看次数

如何使用ConfigurationElementCollection实现ConfigurationSection

我正在尝试在项目中实现自定义配置部分,并且我一直在遇到我不理解的异常.我希望有人能填补这里的空白.

App.config看起来像这样:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="ServicesSection" type="RT.Core.Config.ServicesConfigurationSectionHandler, RT.Core"/>
    </configSections>
    <ServicesSection type="RT.Core.Config.ServicesSection, RT.Core">
            <Services>
                <AddService Port="6996" ReportType="File" />
                <AddService Port="7001" ReportType="Other" />
            </Services>
        </ServicesSection>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我有一个ServiceConfig像这样定义的元素:

public class ServiceConfig : ConfigurationElement
  {
    public ServiceConfig() {}

    public ServiceConfig(int port, string reportType)
    {
      Port = port;
      ReportType = reportType;
    }

    [ConfigurationProperty("Port", DefaultValue = 0, IsRequired = true, IsKey = true)]
    public int Port 
    {
      get { return (int) this["Port"]; }
      set { this["Port"] = value; …
Run Code Online (Sandbox Code Playgroud)

c# configuration app-config configuration-files

157
推荐指数
5
解决办法
14万
查看次数

使用inheritInChildApplications避免子Web应用程序中的web.config继承

我想补充一下

<location inheritInChildApplications="false">
Run Code Online (Sandbox Code Playgroud)

到我的父Web应用程序的web.config但它似乎没有工作.

我的父母web.config有:

<configuration>
    <configSections>
    </configSections>

    // 10 or so custom config sections like log4net, hibernate,

    <connectionStrings>
    </connectionStrings>

    <appSettings>
    </appSettings>

    <system.diagnostics>
    </system.diagnostics>

    <system.web>
         <webParts>
         </webParts>
         <membership>
         </membership>

         <compilation>
         </compilation>
    </system.web>

    <location ..>
    <system.web>
        </system.web>
    </location>

    <system.webServer>
    </system.webServer>
Run Code Online (Sandbox Code Playgroud)

我的子Web应用程序在IIS中设置为应用程序,并且继承了web.config导致问题的父级应用程序.

我应该在哪里放置

<location inheritInChildApplications="false">
Run Code Online (Sandbox Code Playgroud)

所以它忽略了所有各种web.config设置?

asp.net configuration iis-7 web-config

148
推荐指数
5
解决办法
18万
查看次数

在SQL Server数据库中使用单行配置表.馊主意?

在开发购物车应用程序时,我发现我需要根据管理员的偏好和要求保存设置和配置.此信息可以是公司信息,运输帐户ID,PayPal API密钥,通知首选项等.

创建一个表来在关系数据库系统中存储单行似乎非常不合适.

存储此信息的适当方法是什么?

注意:我的DBMS是SQL Server 2008,编程层是用ASP.NET实现的(在C#中).

sql configuration database-design relational-database

141
推荐指数
4
解决办法
4万
查看次数

Nginx中$ host和$ http_host的区别是什么

在Nginx中,变量$host和变量之间有什么区别$http_host.

configuration nginx http-headers

140
推荐指数
3
解决办法
12万
查看次数

确定正在使用的配置文件

是否有命令确定MySQL 5.0当前使用的配置文件?

mysql configuration

136
推荐指数
8
解决办法
18万
查看次数

为我的Rails应用程序创建自定义配置选项的最佳方法?

我需要为我的Rails应用程序创建一个配置选项.对于所有环境都可以是相同的.我发现,如果我把它设置好environment.rb,它可以在我的视图中使用,这正是我想要的......

environment.rb

AUDIOCAST_URI_FORMAT = http://blablalba/blabbitybla/yadda
Run Code Online (Sandbox Code Playgroud)

效果很好.

但是,我有点不安.这是一个很好的方法吗?有没有更时尚的方式?

ruby environment configuration ruby-on-rails

132
推荐指数
7
解决办法
7万
查看次数

如果使用maven,通常你将log4j.properties放在java或资源下?

在使用传统的Maven目录时,我应该在哪里放置log4j.properties文件?

java configuration log4j maven

126
推荐指数
5
解决办法
13万
查看次数

在Xcode中添加构建配置

我想在Xcode 5中添加一个新的构建配置,"QA",到我们目前拥有的其他三个(Debug,Distribution,Release).但是,当我单击"编辑器>添加配置"时,一切都显示为灰色.我不是很熟悉Xcode,所以我不知道如何去做.

它有灰色的原因吗?这个过程是否添加了构建配置?谢谢.

configuration build xcode5

126
推荐指数
2
解决办法
4万
查看次数