小编Nov*_*ato的帖子

Haproxy ssl配置 - 安装根证书和中间证书

经过大量的谷歌搜索,我终于让我的haproxy ssl工作.但是现在我遇到了问题,因为没有安装root和中间证书所以我的ssl没有绿色条.

我的haproxy配置

global
      maxconn     4096 
      nbproc      1
      #debug
      daemon
      log         127.0.0.1    local0

  defaults
      mode        http
      option      httplog
      log         global
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

  frontend unsecured
      bind 192.168.0.1:80
      timeout     client 86400000
      reqadd X-Forwarded-Proto:\ http
      default_backend      www_backend

  frontend  secured
  mode http
   bind 192.168.0.1:443 ssl crt /etc/haproxy/cert.pem
   reqadd X-Forwarded-Proto:\ https
  default_backend www_backend

  backend www_backend
      mode        http
      balance     roundrobin
      #cookie      SERVERID insert indirect nocache
      #option      forwardfor
      server      server1 192.168.0.2:80  weight 1 maxconn 1024 check
      server      server2 192.168.0.2:80  weight …
Run Code Online (Sandbox Code Playgroud)

ssl openssl load-balancing centos haproxy

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

内联标记块不能嵌套.只允许一级内联标记.MVC RAZOR

我是一个带有telerik网格的模态窗口.但我需要在我的网格中渲染图像,以便我理解我不能使用@两次.这是关于此问题链接的博客文章

请有人帮助我.

我的守则

@{  Html.Telerik().Window()
    .Name("images")
    .Title("Select an Image")
    .Content(@<text>

@(Html.Telerik().ComboBox()
            .Name("AjaxComboBox66")
            .AutoFill(true)
            .SelectedIndex(0)
            .BindTo(new SelectList(Model.PhotoFolders, "ID", "Name"))
            .Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.StartsWith))
            .HighlightFirstMatch(true)
            .ClientEvents(events => events
                .OnChange("onChange")
            )
      )

      @(Html.Telerik().Grid<AjaxImages>()
    .Name("Grid")
    .DataKeys(keys => keys.Add(c => c.ID))
  .Columns(columns =>
  {
      columns.Template(
          @<text>
               <img src='@item.Url' /> 
//Here is my error. I need helper function
           </text>

).Title("Picture");

  })

                              .DataBinding(dataBinding => dataBinding.Ajax().Select("GetImages", "UserProducts"))

                      .Scrollable(scrolling => scrolling.Enabled(true))
                      .Sortable(sorting => sorting.Enabled(true))
                          .Pageable(paging => paging.Enabled(true).PageSize(20).Total(100).Style(GridPagerStyles.NextPreviousAndNumeric))
                      .Filterable(filtering => filtering.Enabled(true))
                      .Groupable(grouping => grouping.Enabled(false))
                      .EnableCustomBinding(true)

                      .Footer(true))
              </text>)
    .Width(400)
    .Draggable(true) …
Run Code Online (Sandbox Code Playgroud)

grid telerik razor asp.net-mvc-3

10
推荐指数
1
解决办法
5962
查看次数

我可以删除默认的MongoDB索引吗?

我有一个集合,我不需要任何索引.我只存储用户搜索词和日期,所以我的收藏非常简单.

class UserSearch {

public string Term {get; set;}
pulic DateTime Date {get;set;}

}
Run Code Online (Sandbox Code Playgroud)

当我存储一个UserSearch项时,我的集合上有_id和默认索引.

根据我的知识,那些"_id"字段将在ram中编入索引,所以我不想花费ram内存用于收集,我只是存储并且我每12小时计算一次.

我试着删除它,但我不能.

   var indexes = UserSearch(true).GetIndexes();

   //delete UserSearch Default Index
   if(UserSearch(true).IndexExistsByName("_id_"))
   {
     UserSearch(true).DropIndexByName("_id_");
   }
Run Code Online (Sandbox Code Playgroud)

有什么建议/解决方案吗?

indexing mongodb nosql

8
推荐指数
2
解决办法
5901
查看次数

谷歌CDN随机不提供gzip内容

我需要一些高级人员给我一个建议,这是一个谷歌CDN错误或我想念的东西.我发现这个错误就像4个月前,试图联系他们的支持,但他们是如此粗鲁,我不想在这里谈论这个.他们接受了,至少他们告诉我他们会将问题发送给后端团队,但之后他们删除了问题跟踪器,他们不再回复我的电子邮件了.这就是我在这里问的主要原因.

问题

Google CDN随机不向最终用户提供gzip内容.因此,他们下载500KB文件而不是~70KB.我不能直接将这个问题产生于我的原点,但我可以在Google CDN上轻松地解决这个问题.

以下是CDN的示例请求:

请求:

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8,bg;q=0.6,hr;q=0.4,mk;q=0.2,sr;q=0.2
Cache-Control:no-cache
Connection:keep-alive
Cookie: example
Host: example.com
Pragma:no-cache
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
Run Code Online (Sandbox Code Playgroud)

响应:

Accept-Ranges:bytes
Age:58422
Alt-Svc:clear
Cache-Control:public, max-age=604800
Content-Length:550158
Content-Type:text/css
Date:Tue, 04 Apr 2017 03:45:53 GMT
Expires:Tue, 11 Apr 2017 03:45:53 GMT
Last-Modified:Sun, 19 Mar 2017 01:50:22 GMT
Server:LiteSpeed
Via:1.1 google
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我的请求有accept-encoding:gzip header但我收到的不是gzip内容.而不是70KB我收到500KB.另请注意Age标题,该项目在CDN上缓存/存在58422秒!

这是来自另一台机器(美国)的相同请求

请求:

:authority: xxx
:method:GET
:path:/wp-content/themes/365/style.css
:scheme:https
accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
accept-encoding:gzip, deflate, sdch, br
accept-language:en-US,en;q=0.8
cache-control:no-cache
cookie: xxx
pragma:no-cache …
Run Code Online (Sandbox Code Playgroud)

cdn google-compute-engine google-cloud-platform

8
推荐指数
1
解决办法
1020
查看次数

PHP子字符串和渲染的HTML上的奇怪图标

我真的不知道为什么在西里尔字体上,substring用"?"替换一些字符

我的守则

$string1 = get_the_content();
$string = strip_tags($string1);
$stringcutted = substr($string,0,150);
$replacement = "...";
$final = substr($stringcutted, 0, -3).$replacement;
Run Code Online (Sandbox Code Playgroud)

看看它是如何在html上呈现的

奇怪的icon1 奇怪的icon2

有解决方案吗

php string substring

6
推荐指数
1
解决办法
896
查看次数

混合Linux和Windows MongoDB副本集,对于分片来说是相同的硬件

我的第一个问题非常简单,我只是想知道我是否可以在我的分片/副本群集中混合使用Linux和Windows mongodb服务器,ofc和2.2一样的版本?

对于第二个问题,有人可以解释一下,如果我有这个硬件的分片服务器,会发生什么

  • 服务器1:高CPU,SSD磁盘
  • 服务器2:普通CPU,Sata磁盘
  • 服务器3:普通CPU,SSD磁盘

当我们有不同的硬件服务器时,分片将如何工作?

在具有几乎相同硬件的机器上构建集群是否重要?

replication sharding cluster-computing mongodb

6
推荐指数
1
解决办法
939
查看次数

在Centos 6下Mongo读取速度慢

我成功基本配置了我的副本集,但我发现读取性能很慢.我的副本集中有2个mongo服务器和1个仲裁器.所有这些都在Centos 6.3最小设置(只是数据库)上运行.

我在另一台Windows服务器2012上也有单个mongo实例.

在构建我的副本集之前,我的Web服务器与Mongo(即Windows实例)在同一个操作系统上.表现很好,结果很像

C#.NET 4.5(同一VM上的IIS和Mongo)读取2000行:AvgObj 2600字节~250ms

现在使用我的副本集,我的读取性能非常慢.当我的Web服务器访问副本集时,我得到的结果就像

C#.NET 4.5(在Centos副本上分离,IIS和Mongo)读取2000行:在AvgObj 2600字节的〜2500ms

我尝试从远程IIS中读取我的单个Mongo瞬间,结果就像

C#.NET 4.5(在Windows上分离,IIS和单Mongo)读取2000行:在AvgObj 2600字节〜600ms

所有服务器都在使用Hyper-V核心服务器的单个物理机器上运行.

我使用最新的C#MongoDB驱动程序1.7版本.从我在命令shell中测试的,在所有mongo服务器上,我的查询在10ms内执行.

任何人都可以给我建议为什么我的副本设置在分离的Centos服务器上具有较慢的读取性能?是网络,司机还是其他什么?

我的C#配置是

            var server1 = new MongoServerAddress("1.0.0.1"); //primary
            var server2 = new MongoServerAddress("1.0.0.2"); /secundary
            var servers = new List<MongoServerAddress> {server1, server2};

            var safe = new MongoClientSettings
                {

                    Servers = servers,
                    ReplicaSetName = "rs0",
                    ConnectionMode = ConnectionMode.ReplicaSet,
                    WriteConcern = new WriteConcern
                        {
                            Journal = false,
                            W = 1
                        },
                    ReadPreference = new ReadPreference
                        {
                            ReadPreferenceMode = ReadPreferenceMode.PrimaryPreferred
                        }
                };
Run Code Online (Sandbox Code Playgroud)

networking mongodb

6
推荐指数
1
解决办法
1102
查看次数

ServiceStack.Text和ISODate("")

为什么ServiceStack.Text DeserializeFromString无法转换ISODate格式.

例如,我有像json字符串

{ "Count" : 4, "Type" : 1, "Date" : ISODate("2013-04-12T00:00:00Z") }
Run Code Online (Sandbox Code Playgroud)

和班级

public class TestClass
{
    public int Count { get; set; }
    public int Type { get; set; }
    public DateTime Date { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试从字符串反序列化

JsonSerializer.DeserializeFromString<TestClass>(json);
Run Code Online (Sandbox Code Playgroud)

给我输出像 在此输入图像描述

c# json deserialization servicestack

6
推荐指数
2
解决办法
3055
查看次数

DirectoryEntry IIS访问权限

我有一个控制台应用程序,该应用程序列出了IIS中的网站绑定

using (var directoryEntry = new DirectoryEntry("IIS://localhost/w3svc/" + GetWebSiteId())) {
    var bindings = directoryEntry.Properties["ServerBindings"]; 
}
Run Code Online (Sandbox Code Playgroud)

我通过过程从ASP.NET调用此控制台应用程序

var process = new Process {
   StartInfo = new ProcessStartInfo {
       FileName = "c:/app.exe",
       Arguments = "check",
       UseShellExecute = false,
       RedirectStandardOutput = true,
       CreateNoWindow = true
    }
};
Run Code Online (Sandbox Code Playgroud)

在Widows 7 / IIS 7.5下的开发机上,一切正常,但是当我在Windows 2012 / IIS 8上进行测试时,我收到“拒绝访问”错误。

错误记录

"System.Runtime.InteropServices.COMException (0x80070005): Access is denied.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.ChildEnumerator..ctor(DirectoryEntry container)
at System.DirectoryServices.DirectoryEntries.GetEnumerator()
at IISSubdomainManagement.Program.GetWebSiteId()
at IISSubdomainManagement.Program.TotalBindings()
at IISSubdomainManagement.Program.Main(String[] args)"
Run Code Online (Sandbox Code Playgroud)

ps应用程序池标识为“ ApplicationPoolIdentity” …

c# windows security iis iis-8

5
推荐指数
1
解决办法
8316
查看次数

将值传输到动态加载的Web用户控件

我有ASPX页面在preinit我检查whitch用户控件加载.

 control = "~/templates/" + which + "/master.ascx";
Run Code Online (Sandbox Code Playgroud)

然后在pageload上,我加载该控件

 Control userControl = Page.LoadControl(control);
 Page.Controls.Add(userControl);
Run Code Online (Sandbox Code Playgroud)

我如何将动态加载的用户控件从aspx转移到ascx?

.net c# asp.net user-controls

3
推荐指数
1
解决办法
2877
查看次数