4

我有一个 asp.net mvc 应用程序。在 windows server 2008 R2 和 framework 4.5 上运行。在一个控制器上。我通过 https 通道使用 httpclient post xml 到远程肥皂服务器。但很慢。完成请求需要 6 秒。我启用 CAPI2 日志。发现错误:

> System 
>
>  - Provider 
>
>   [ Name]  Microsoft-Windows-CAPI2 
>   [ Guid]  {5bbca4a8-b209-48dc-a8c7-b23d3e5216fb} 
> 
>   EventID 53 
> 
>   Version 0 
> 
>   Level 2 
> 
>  Task 53 
> 
>   Opcode 2 
> 
>   Keywords 0x4000000000000036 
> 
>  - TimeCreated 
>
>   [ SystemTime]  2013-03-06T00:09:12.342400000Z 
> 
>   EventRecordID 226 
> 
>   Correlation 
> 
>  - Execution 
>
>   [ ProcessID]  4716 
>   [ ThreadID]  3620 
> 
>   Channel Microsoft-Windows-CAPI2/Operational 
> 
>   Computer WIN-PFVACQLB4A9 
> 
>  - Security 
>
>   [ UserID]  S-1-5-82-100694679-852442941-408577778-1461352480-452402374 
> 
>
>- UserData 
>
>  - CryptRetrieveObjectByUrlWire 
>
>  - URL http://gtssldv-aia.geotrust.com/gtssldv.crt 
>
>   [ scheme]  http 
> 
>  - Object 
>
>   [ type]  CONTEXT_OID_CERTIFICATE 
>   [ constant]  1 
> 
>   Timeout PT15S 
> 
>  - Flags 
>
>   [ value]  286005 
>   [ CRYPT_RETRIEVE_MULTIPLE_OBJECTS]  true 
>   [ CRYPT_WIRE_ONLY_RETRIEVAL]  true 
>   [ CRYPT_LDAP_SCOPE_BASE_ONLY_RETRIEVAL]  true 
>   [ CRYPT_OFFLINE_CHECK_RETRIEVAL]  true 
>   [ CRYPT_AIA_RETRIEVAL]  true 
>   [ CRYPT_PROXY_CACHE_RETRIEVAL]  true 
> 
>  - AuxInfo 
>
>   [ maxUrlRetrievalByteCount]  100000 
>   [ fProxyCacheRetrieval]  true 
> 
>  - AdditionalInfo 
>
>  - NetworkConnectivityStatus 
>
>   [ value]  1 
>   [ _SENSAPI_NETWORK_ALIVE_LAN]  true 
> 
>  - Action 
>
>   [ name]  Call_WinHttpGetProxyForUrl 
>  - Error The Proxy Auto-configuration URL was not found. 
>
>   [ value]  2F94 
> 
> 
>  - Action 
>
>   [ name]  NoProxy 
> 
>  - Action 
>
>   [ name]  Call_WinHttpGetProxyForUrl 
>  + Error The Proxy Auto-configuration URL was not found. 
>
>   [ value]  2F94 
> 
> 
>  - Action 
>
>   [ name]  NoProxy 
> 
>  - HTTPRequestHeadersInfo 
>
>   Header GET /gtssldv.crt HTTP/1.1 
> 
>   Header Accept: */* 
> 
>   Header User-Agent: Microsoft-CryptoAPI/6.1 
> 
>   Header Connection: Keep-Alive 
> 
> 
>  - HTTPResponseHeadersInfo 
>
>   Header HTTP/1.0 200 OK 
> 
>   Header Connection: Keep-Alive 
> 
>   Header Date: Tue, 05 Mar 2013 23:43:39 GMT 
> 
>   Header Via: NS-248 
> 
>   Header Via: 1.0 hostname:80 (squid/2.6.STABLE21) 
> 
>  Header Content-Length: 1022 
> 
>   Header Content-Type: text/plain 
> 
>   Header Last-Modified: Wed, 21 Jul 2010 18:25:03 GMT 
> 
>   Header Accept-Ranges: bytes 
> 
>   Header Age: 540 
> 
>   Header ETag: "25f7fb-3fe-48be9eb969dc0" 
> 
>   Header Server: Apache/2.2.3 (Red Hat) 
> 
>   Header X-Pad: avoid browser bug 
> 
>   Header X-Cache: MISS from hostname 
> 
>   Header X-Cache-Lookup: HIT from hostname:80 
> 
> 
>  - Action 
>
>   [ name]  WriteToCache 
>  - Error The system cannot find the file specified. 
>
>   [ value]  80070002 
> 
> 
> 
>  - CacheInfo 
>
>   [ lastSyncTime]  2013-03-06T00:09:12.342Z 
>  - URLCacheResponseInfo 
>
>  [ responseType]  CRYPTNET_URL_CACHE_RESPONSE_HTTP 
>   [ lastModifiedTime]  2010-07-21T18:25:03Z 
>   [ eTag]  "25f7fb-3fe-48be9eb969dc0" 
>   [ proxyId]  DEAE4085 
> 
> 
>  - RetrievedObjects 
>
>  - Certificate 
>
>   [ fileRef]  BAE30B15DBB1544CF194D076B75B7BB9E3D6B760.cer 
>   [ subjectName]  GeoTrust DV SSL CA 
> 
> 
>  - EventAuxInfo 
>
>   [ ProcessName]  w3wp.exe 
> 
>  - CorrelationAuxInfo 
>
>   [ TaskId]  {2B4FC750-01D1-4D7E-BEEF-A3F9DD09B0E8} 
>   [ SeqNumber]  4 
> 
>  - Result 
>
>   [ value]  0 

我还取消选中 Internet Exploer->Internet 选项->连接->LAN 设置-> 自动检测设置。没变化。

寻求帮助。

谢谢

4

2 回答 2

1

可能为时已晚,但我解决相同问题的方法是找到用户 ID,在您的情况下:

[ UserID]  S-1-5-82-100694679-852442941-408577778-1461352480-452402374

在注册表中,在以下位置:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList .

它会告诉您哪个用户正在调用 Crypto API 2 (CAPI2),在我的例子中是“经典 .NET 应用程序池”或类似的。

我通过模拟(以具有足够权限的另一个用户身份运行进程)来修复它,然后我不再有这个写入错误,因此事件日志中没有红色错误消息。

为此,我在本地计算机中创建了一个具有管理员权限的用户(我知道这不是最安全的选项,但我不得不尝试,并且成功了)。最后,似乎问题出在代理上,但就是那个特定的错误:。

>   [ name]  WriteToCache 
>  - Error The system cannot find the file specified. 
>
>   [ value]  80070002 
> 

它在某处没有写权限,但管理员有:P

我还做了另一件事(因为加密 API 总是请求 CRL),在本地组策略编辑器中,遵循以下路径:

计算机配置 > Windows 设置 > 安全设置 > 公钥 > 证书路径验证设置 > “吊销”选项卡。启用“定义这些策略设置”并启用“允许 CRL 和 OCSP 响应的有效时间超过其生命周期”。

然后我将这个 CRL 的有效期延长到一年(8760 小时),我知道这也太长了,但这取决于您的需求或安全问题,在我的情况下是足够安全的。

我希望它可以帮助你

于 2014-01-03T15:04:50.380 回答
0

我的答案取自这里:http ://social.technet.microsoft.com/Forums/en-US/winserversecurity/thread/82c52c69-1a53-4f48-8c7e-37bc7364dca3/

设置一个 IIS 服务器,以便它会在http://wpad.mylab.local/wpad.dat中使用 javascript 进行响应- 不要忘记为 wpad.dat 添加 MIME 类型(应用程序/x-javascript 很好)。如果您不需要代理,则 wpad.dat 文件中的 javascript 应如下所示:

function FindProxyForURL(url, host)
{
    return "DIRECT";
}

之后,在使用 certutil 时,CAPI2 日志中不应再有事件 53。

于 2013-05-29T18:50:10.717 回答