小编chr*_*isb的帖子

为ServicePointManager.SecurityProtocol设置每个请求值

在c#中,我能够为SSL3或TLS设置静态值,例如

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
Run Code Online (Sandbox Code Playgroud)

要么:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
Run Code Online (Sandbox Code Playgroud)

但是(我相信)这将影响我的应用程序中所有未来的HttpWebRequest对象.

有没有办法为给定的HttpWebRequest或至少为给定的URI设置此值?

注意我看到了这个:

Uri uri = new Uri(url);
ServicePoint sp = ServicePointManager.FindServicePoint(uri);
Run Code Online (Sandbox Code Playgroud)

但ServicePoint没有SecurityProtocol属性.

目前我认为我必须在创建新的HttpWebRequest之前设置静态全局属性.

这感觉不对,这也意味着:

  • 我必须确保多个线程不同时执行此操作.
  • 我不确定这个设置在什么时候被"使用"(即当我调用webRequest.GetResponse()时,是否访问了ServicePointManager.SecurityProtocol并绑定到该URI?).

c# ssl httpwebrequest

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

"从表中选择计数(id)"在SQL Azure中最多需要30分钟来计算

我在SQL Azure中有一个数据库,在15到30分钟之间做一个简单的操作:

select count(id) from mytable
Run Code Online (Sandbox Code Playgroud)

数据库大约3.3GB,计数返回大约2,000,000,但我已经在本地尝试过,只需不到5秒!

我也运行了一个:

ALTER INDEX ALL ON mytable REBUILD
Run Code Online (Sandbox Code Playgroud)

在数据库中的所有表上.

如果有人能指出我试图诊断/解决这个问题,我将不胜感激.

(请跳到下面的更新3,因为我现在认为这是问题,但我仍然不明白).

更新1:聚集索引扫描中99%的时间似乎如下图所示.我有

在此输入图像描述

更新2:这就是我做的时候统计信息的回复:

SET STATISTICS IO ON
SET STATISTICS TIME ON
select count(id) from TABLE
Run Code Online (Sandbox Code Playgroud)

统计:

SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 0 ms.

 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.
SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 317037 ms.

 SQL Server …
Run Code Online (Sandbox Code Playgroud)

azure sqlperformance azure-sql-database

13
推荐指数
2
解决办法
4027
查看次数

简单选择计数(id)使用100%的Azure SQL DTU

这个问题这个问题开始,但现在似乎更恰当地问了,因为我意识到这是一个与DTU相关的问题.

基本上,运行:

select count(id) from mytable
Run Code Online (Sandbox Code Playgroud)

编辑:添加where子句似乎没有帮助.

运行8到30 分钟(而SQL Server的本地副本上的相同查询大约需要4 ).

下面是运行此查询时Azure门户中MONITOR选项卡的屏幕截图.注意我在没有触及数据库大约一周后做了这个,Azure报告我只使用了1%的DTU.

在此输入图像描述

一些额外的东西:

  • 在此特定测试中,查询运行时间为08:27.
  • 当它运行时,上面的图表实际上显示DTU线在一段时间内处于100%.
  • 数据库配置标准服务层,具有S1性能级别.
  • 数据库大约是3.3GB,这是最大的表(计数返回大约2,000,000).

我很欣赏它可能只是我有限的理解,但如果有人能够澄清这是否真的是预期的行为(即一个简单的计数需要这么长时间才能运行并最大化我的DTU),我将非常感激.

azure sqlperformance azure-sql-database

13
推荐指数
1
解决办法
3263
查看次数

从Github和VS.NET将新的Relic Instrumented Site部署到Azure时出错

我收到以下错误:

Error: The process cannot access the file 'C:\DWASFiles\Sites\mywebsitename\VirtualDirectory0\site\wwwroot\newrelic\NewRelic.Agent.Core.dll' because it is being used by another process.
Run Code Online (Sandbox Code Playgroud)

在尝试从Github部署Azure网站时,在Running deployment命令...日志文件中.

将不胜感激任何可能导致此问题的指示.

更新:当直接从VS.NET发布以下内容时,这也失败了:

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4196,5): Warning : An error was encountered when processing operation 'Create File' on 'NewRelic.Agent.Core.dll'.  
1>Retrying operation 'Update' on object filePath (mywebsitename\newrelic\NewRelic.Agent.Core.dll). Attempt 1 of 2.
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4196,5): Error : Web deployment task failed. ((06/07/2013 23:54:58) An error occurred when the request was processed on the remote computer.)
Run Code Online (Sandbox Code Playgroud)

这是以前工作,我不知道为什么它会停止.

azure newrelic

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

有效地检索所有 GitHub 提交的统计信息

有没有比遍历每个提交并调用以下命令更有效的方法来获取与提交相关的添加/删除计数:

GET /repos/:owner/:repo/commits/:sha
Run Code Online (Sandbox Code Playgroud)

( https://developer.github.com/v3/repos/commits/ )

只是为了得到:

"stats": {
   "additions": 104,
   "deletions": 4,
   "total": 108
},
Run Code Online (Sandbox Code Playgroud)

数据?

不幸的是,提交端点:

GET /repos/:owner/:repo/commits
Run Code Online (Sandbox Code Playgroud)

包含大量关于每次提交的数据,但不包含这个细节,这意味着需要大量额外的 API 调用来获取它。

github-api

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

https://graph.facebook.com/debug_token是否仅适用于应用开发人员?

网站工具位于:https: //developers.facebook.com/tools/debug/

任何用户都可以使用它来检查它们的令牌,但似乎是API终点:https: //graph.facebook.com/debug_token

仅适用于app开发人员.

首先,我只想确认是这种情况?

其次,我想知道如果有一个API端点来检查任何令牌是否是这样的话?无法理解为什么不允许这样做,因为有一个UI /网页功能来执行此操作.

facebook-graph-api

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