首页 \ 问答 \ ASP.NET - 请求已中止:无法创建SSL / TLS安全通道(ASP.NET - The request was aborted: Could not create SSL/TLS secure channel)

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 an HTTPS 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
更新时间:2023-06-01 11:06

最满意答案

为什么会发生这种情况的答案如下

在将其保存之前, 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的间谍(),你已经尝试过。 但我认为使用spy()的另一种方式会使它工作。 ParentClass.java public class ParentClass { public String doStuff(final String parameters) { return "parent"; } } InheritedClass.java public class InheritedClass extends ParentClass { @ ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。