小编col*_*mbo的帖子

从ASMX返回JSON,并在Javascript中正确处理它

我意识到这里已经有很多类似的问题,但我无法想出这个问题.

我有一个Web服务(C#,.net 3.5).您需要了解的基本代码如下:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class WSMember : System.Web.Services.WebService {

    public WSMember () {   
    }


    [WebMethod]
    [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
    public string GetMember(string IdMember)
    {
        //Ignore the parameter for now... I will be looking up a database with it... 
        //For now just return a minimal object:
        Member m = new Member();
        m.Surname = "Smith";
        m.FirstName = "John";
        return new JavaScriptSerializer().Serialize(m);
    }
Run Code Online (Sandbox Code Playgroud)

另外,在web.config中,我做了以下添加(我刚刚在其他帖子中看到过......这是正常/安全吗?)

  <webServices>
      <protocols>
        <add name="HttpGet" />
        <add name="HttpPost" />
      </protocols>
    </webServices> …
Run Code Online (Sandbox Code Playgroud)

asp.net ajax jquery json asmx

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

Postgresql:如何确保索引在内存中

我一直在尝试在Windows Server 2012上的Azure VM上运行postgres 9.3.我最初在7GB服务器上运行它...我现在在14GB Azure VM上运行它.在尝试解决下面描述的问题时,我增加了一个尺寸.

顺便说一句,我对posgresql很新,所以我只是逐点了解配置选项.此外,虽然我喜欢在Linux上运行它,但我和我的同事根本没有专业知识来解决Linux中出现问题时的问题,因此Windows是我们唯一的选择.

问题描述:

我有一个名为test_table的表; 它目前存储大约9000万行.它将每月增长约3-4百万行.test_table中有2列:

id (bigserial)
url (charachter varying 300)
Run Code Online (Sandbox Code Playgroud)

我从几个CSV文件导入数据创建了索引.两列都被编入索引.... id是主键.url上的索引是使用默认值通过pgAdmin创建的普通btree.

我跑的时候:

SELECT sum(((relpages*8)/1024)) as MB FROM pg_class WHERE reltype=0;
Run Code Online (Sandbox Code Playgroud)

...总大小为5980MB

这里讨论的2个索引的单个大小如下,我通过运行得到它们:

 # SELECT relname, ((relpages*8)/1024) as MB, reltype FROM pg_class WHERE 
  reltype=0 ORDER BY relpages DESC LIMIT 10;


             relname      |  mb  | reltype
----------------------------------+------+--------
 test_url_idx             | 3684 |       0
 test_pk                  | 2161 |       0
Run Code Online (Sandbox Code Playgroud)

其他较小的表上还有其他索引,但它们很小(<5MB)....所以我在这里忽略了它们

使用url查询test_table时遇到的麻烦,特别是在搜索中使用通配符时,速度(或缺少速度).例如

select * from test_table where url like 'orange%' limit 20;
Run Code Online (Sandbox Code Playgroud)

...需要20-40秒才能运行.

对上面的运行说明分析给出了以下内容:

# …
Run Code Online (Sandbox Code Playgroud)

sql postgresql indexing configuration

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

如何使用带有Flowplayer的RTMP从Cloudfront运行私有内容视频

重现步骤:

  1. 设置S3桶
  2. 建立流媒体分配
  3. 生成云端密钥对
  4. 使用RSA私钥下载.PEM文件
  5. 使用http://www.jensign.com/opensslkey/opensslkey.cs从RSA密钥生成XML
  6. 上传文件"testUnsecure.flv",设置ACL属性,以便每个人都可以查看它.
  7. 使用以下java脚本设置网页:

    var p = flowplayer("rtmpPlayer",{src:"flowplayer-3.1.5.swf",height:"480px"},{plugins:{rtmp:{url:'flowplayer.rtmp-3.1.3.swf', netConnectionUrl:'rtmp://s3py83uop6xa8x.cloudfront.net/cfx/st',objectEncoding:'0'}},clip:{autoPlay:false,url:'flv:testUnsecure',provider:'rtmp'}});

  8. 这有效!

然后做了这个:

  1. 上传testSecure.flv,设置ACL使其成为私有
  2. 生成签名URL并构建字符串.javascript中的url如下所示:

网址: 'FLV:testSecure%3fExpires%3d1277469187%26Signature%3dE5OleaO26fwLi6jIKTa4inc8I4P86AgTg5x8SmleTSTyf5C5AfnQyqaFXLDjiF0kiqdplhauA8Kw%7eS37EpRBAn-aJrJScVlw7aZ-SAL24MTLMZ9foSkCd2ai9KjS8AuuweJRwPWmf4eLDpI4X4f3k3H7UUVcq8SX92ed5fCB91w_%26Key对 - ID%3dAPKAJUIBASIKTLFDSDFA'

这失败了.视频只是挂在那里....

有谁知道怎么做

  1. 使用C#为私有视频生成签名URL?
  2. 在Flowplayer或JWPLayer中播放视频(我将使用我可以使用的任何一个!)

还有几点 - 我使用与此相同的代码来生成签名URL:http://beckelman.net/post/2010/03/30/Policy-Signing-in-C-for-Streaming-Private-Content-从-亚马逊CloudFront.aspx

如果你们能解决这个问题,我会为居住在距离我100英里范围内的所有人买一杯饮料.

c# stream rtmp amazon-web-services amazon-cloudfront

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

找不到类型或命名空间名称"ApplicationUserManager"

我已经跟随Rick Anderson的以下文章: Facebook,Twitter,LinkedIn和Google OAuth2登录MVC 5应用程序

我正在尝试测试Google身份验证并在我的本地计算机上运行...

Startup.Auth.cs如下(这次完全符合每篇文章):

// Configure the db context and user manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);


// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
// Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
    LoginPath = new PathString("/Account/Login"),
    Provider = new …
Run Code Online (Sandbox Code Playgroud)

model-view-controller google-login

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

如何构建 Nest SearchRequest 对象并查看查询中的原始 JSON?

我正在使用 Nest 6.2 和 ES 6.6

我有以下运行良好的代码:

var response = elasticClient.Search<PropertyRecord>(s => s
    .Query(q => q.Terms(
        c => c
            .Field(f => f.property_id_orig)
            .Terms(listOfPropertyIds) // a list of 20 ids say... 
    ))
    .From(0)
    .Take(100) // just pull up to a 100... 
);

if (!response.IsValid)
    throw new Exception(response.ServerError.Error.Reason);

return response.Documents;
Run Code Online (Sandbox Code Playgroud)

但我知道底层查询存在问题,因为索引中的所有文档都会返回。所以我希望能够看到 lambda 表达式生成的原始 Json,这样我就可以看到在 Head 插件或 Fiddler 等中运行的结果。

如果我使用 SearchRequest 对象并将其传递给 Search 方法,我是否能够看到查询 Json?

var request = new SearchRequest
{
    // and build equivalent query here
};
Run Code Online (Sandbox Code Playgroud)

我在使用 SearchRequest 方法构建相应的查询时遇到问题,并且找不到合适的示例来说明如何执行此操作。

有人知道吗?

c# elasticsearch nest

0
推荐指数
1
解决办法
3742
查看次数