當你trace到 var secretKey = CngKey.Import 時,會遇到「system cannot find the file specified 」例外,
相對的,你的application pool identity也要提高權限
「call to SSPI failed, see inner exception. StackTrace: at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
-------------------
2.Install WinHttpHandler:
Install-Package System.Net.Http.WinHttpHandler
3.Extend WinHttpHandler to add http2.0 support:
public class Http2CustomHandler : WinHttpHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
request.Version = new Version("2.0");
return base.SendAsync(request, cancellationToken);
}
}
4.Pass above handler to the HttpClient constructor
using (var httpClient = new HttpClient(new Http2CustomHandler()))
{
// your custom code
}
---------------------------------
(所以就是要用非同步的方式去呼叫了,沒差,用執行緒去做就是了)
雖然案主說你就再申請一個apns 憑證嘛.何必這樣大費周章?
可是每一個憑證每年都要換證,就是怕在換證時uer漏接了重要的訊息
這次一做,日後很多個APP都可以共用,也沒有期限問題,長痛不如短痛啊,根本性地解決問題,不亦快哉?