我有一个.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并具有重建以使其使用正确的设置.
是否有更好/推荐/首选的方法来实现类似的效果?或者同样,我接近这个完全错误并且有更好的方法吗?
我有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,但这没有用.
关于可能出错的任何想法?
我正在尝试在项目中实现自定义配置部分,并且我一直在遇到我不理解的异常.我希望有人能填补这里的空白.
我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) 我想补充一下
<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设置?
在开发购物车应用程序时,我发现我需要根据管理员的偏好和要求保存设置和配置.此信息可以是公司信息,运输帐户ID,PayPal API密钥,通知首选项等.
创建一个表来在关系数据库系统中存储单行似乎非常不合适.
存储此信息的适当方法是什么?
注意:我的DBMS是SQL Server 2008,编程层是用ASP.NET实现的(在C#中).
在Nginx中,变量$host和变量之间有什么区别$http_host.
我需要为我的Rails应用程序创建一个配置选项.对于所有环境都可以是相同的.我发现,如果我把它设置好environment.rb,它可以在我的视图中使用,这正是我想要的......
environment.rb
AUDIOCAST_URI_FORMAT = http://blablalba/blabbitybla/yadda
Run Code Online (Sandbox Code Playgroud)
效果很好.
但是,我有点不安.这是一个很好的方法吗?有没有更时尚的方式?
在使用传统的Maven目录时,我应该在哪里放置log4j.properties文件?
我想在Xcode 5中添加一个新的构建配置,"QA",到我们目前拥有的其他三个(Debug,Distribution,Release).但是,当我单击"编辑器>添加配置"时,一切都显示为灰色.我不是很熟悉Xcode,所以我不知道如何去做.
它有灰色的原因吗?这个过程是否添加了构建配置?谢谢.
configuration ×10
asp.net ×2
c# ×2
nginx ×2
.net ×1
app-config ×1
build ×1
domain-name ×1
environment ×1
http-headers ×1
iis-7 ×1
java ×1
log4j ×1
maven ×1
mysql ×1
ruby ×1
sql ×1
vb.net ×1
web-config ×1
xcode5 ×1