ASP.NET - 请求已中止:无法创建SSL / TLS安全通道(ASP.NET - The request was aborted: Could not create SSL/TLS secure channel)
我们收到以下错误;
The request was aborted: Could not create SSL/TLS secure channel
使用
WebRequest
对象发出HTTPS
请求时。 有趣的是,这只会在一段时间后发生,并在应用程序重新启动时暂时修复,这表明某些东西正在被填充到容量或其他东西。以前有人见过这种事吗?
We get the following error;
The request was aborted: Could not create SSL/TLS secure channel
while using a
WebRequest
object to make anHTTPS
request. The funny thing is that this only happens after a while, and is temporarily fixed when the application is restarted, which suggests that something is being filled to capacity or something.Has anyone seen this kind of thing before?
原文:https://stackoverflow.com/questions/42215
最满意答案
为什么会发生这种情况的答案如下
在将其保存之前,
proxyquire
仍然需要底层代码。 它这样做是为了启用呼叫。解决方法只是明确禁止呼叫。
测试变成:
import { expect } from 'chai'; import proxyquire from 'proxyquire'; describe('A Provider', () => { const Provider = proxyquire('../src/a.provider', { './b.provider': { getThing: () => 'b-thing', '@noCallThru': true }, }); describe('defaultPath', () => { it('has the expected value', () => { expect(Provider.defaultPath).to.equal('defaults/a/b-thing') }); }); });
运行此测试完美。
The answer as to why this is happening is as follows
proxyquire
still requires the underlying code before stubbing it out. It does this to enable callthroughs.The solution is simply to explicitly disallow callthroughs.
The test becomes:
import { expect } from 'chai'; import proxyquire from 'proxyquire'; describe('A Provider', () => { const Provider = proxyquire('../src/a.provider', { './b.provider': { getThing: () => 'b-thing', '@noCallThru': true }, }); describe('defaultPath', () => { it('has the expected value', () => { expect(Provider.defaultPath).to.equal('defaults/a/b-thing') }); }); });
Running this test works perfectly.
相关问答
更多-
您正在正确地执行所有操作,除了应该在Spree::PaymentMethod类本身上调用存根方法,而不是在其实例上调用 并且通常的做法是使用此存根返回某个实例,而不仅仅是一个新实例: it 'should find a payment_method' do payment_meth = mock_model(Spree::PaymentMethod) Spree::PaymentMethod.stub!(:find).and_return(payment_meth) @omnikassa.cl ...
-
假设您有以下方法: public boolean doSomething(SomeClass arg); Mockito文档说你不应该这样使用captor: ArgumentCaptor
argumentCaptor = ArgumentCaptor.forClass(SomeClass.class); when(someObject.doSomething(argumentCaptor.capture())).thenReturn(true); // invoke SUT So ... -
为什么会发生这种情况的答案如下 在将其保存之前, proxyquire仍然需要底层代码。 它这样做是为了启用呼叫。 解决方法只是明确禁止呼叫。 测试变成: import { expect } from 'chai'; import proxyquire from 'proxyquire'; describe('A Provider', () => { const Provider = proxyquire('../src/a.provider', { './b.provider': { ...
-
你只需要在发布方法上设置间谍,不需要proxyquire 。 例如 import {expect} from 'chai'; import sinon from 'sinon'; class IPC { constructor() { this.pub = { publish:() => {} //here your redis requirement }; } publish(data) { this.pu ...
-
我尝试了一点,我解决了它。 留下答案,以便其他人可以找到它。 这很有效 SBT "net.codingwell" %% "scala-guice" % "4.1.0", "org.scalatest" % "scalatest_2.12" % "3.0.3", "org.mockito" % "mockito-core" % "2.7.22" 现在将类定义为 class TestModule extends AbstractModule with ScalaModule with MockitoSugar ...
-
proxyquire不会存储未列出的模块,并且它们将像往常一样被要求,因此看起来你在product.controller中有更多的依赖项,并且它们通常都是必需的。 除了为proxyquire提供完整存根之外,我找不到解决此问题的好方法。 proxyquire does NOT stub not listed modules and they will be required as usual, so it looks like you have more dependencies inside produc ...
-
它是JavaScript,因此您可以简单地覆盖它,然后返回原始方法 var originalLogFunction = sails.log.info; var actualArgs; sails.log.info = function(arg1, arg2){ actualArgs = { arg1: arg1, arg2: arg2 }; } // call your method that you test here sails.log.info = originalLogFunction; ...
-
通常情况下,你会模拟控制器规格内的模型: Model.stub!(:find).and_return(mock_model('Model')) Child.stub!(:find).and_return(mock_model('Child')) 但是,当您在rails 3应用程序的Gemfile中使用gem "rspec-rails", "~> 2.0"时,标准rails脚手架生成器将使用rspec为您生成specs,因此运行rails generate scaffold MyResource将生成一些示 ...
-
问题是vuex将getter设置为不可配置的属性,因此无法更改。 对它们进行存根的方法是将getters对象本身存根,以便您的测试可以像这样工作: describe('authenticated-guard.spec.js', () => { it('should redirect to', () => { const authenticatedStub = sandbox.stub(store, 'getters') // Given const to = {} con ...
-
使用Mockito(V 1.9.5)扼杀超类方法的呼叫(Stubbing the call of a super class method using Mockito(V 1.9.5))[2022-03-14]
你可以使用Mockito的间谍(),你已经尝试过。 但我认为使用spy()的另一种方式会使它工作。 ParentClass.java public class ParentClass { public String doStuff(final String parameters) { return "parent"; } } InheritedClass.java public class InheritedClass extends ParentClass { @ ...