首页 \ 问答 \ HttpClient是否可以同时使用?(Is HttpClient safe to use concurrently?)

HttpClient是否可以同时使用?(Is HttpClient safe to use concurrently?)

在所有的例子中,我可以找到HttpClient的用法,它用于一次关闭。 但是如果我有一个持久的客户端情况,可以同时发出几个请求? 基本上,是否可以在同一个HttpClient实例上同时在2个线程上调用client.PostAsync。

我不是真的在这里寻找实验结果。 作为一个工作实例可能只是一个侥幸(和一个持久的),一个失败的例子可能是一个错误的配置问题。 理想情况下,我正在寻找HttpClient中并发处理问题的一些权威性答案。


In all the examples I can find of usages of HttpClient, it is used for one off calls. But what if I have a persistent client situation, where several requests can be made concurrently? Basically, is it safe to call client.PostAsync on 2 threads at once against the same instance of HttpClient.

I am not really looking for experimental results here. As a working example could simply be a fluke (and a persistent one at that), and a failing example can be a misconfiguration issue. Ideally I'm looking for some authoritative answer to the question of concurrency handling in HttpClient.


原文:https://stackoverflow.com/questions/11178220
更新时间:2023-02-14 19:02

最满意答案

更确切地说,.docx文档是OpenXML格式的Zip存档,您首先要解压缩它。
我下载了一个示例(Google: 一些搜索字词filetype:docx ),解压后我发现了一些文件夹。 word文件夹包含文件本身,在文件document.xml中


More exactly, a .docx document is a Zip archive in OpenXML format: you have first to uncompress it.
I downloaded a sample (Google: some search term filetype:docx) and after unzipping I found some folders. The word folder contains the document itself, in file document.xml.

相关问答

更多
  • 这是一个例子 。 它使用docx4j.NET - 这是开源的,你可以从Nuget获得 - 而不是微软的Open XML SDK。 Here's an example. It uses docx4j.NET - which is open source and which you can get from Nuget - not Microsoft's Open XML SDK.
  • 快速解决方法是获取单元的底层文本运行,并更改它。 这有点烦琐,但可以完成。 您可能想要调用cell.getBodyElements()并遍历它们以找到文本中的内容。然后,更改文本,而不是尝试直接更改单元格 更长期的是在POI bugzilla中打开一个新的bug,并上传一个失败的单元测试。 这应该包括您的文件,并显示文本的“替换”,然后保存,重新加载和阅读。 这个问题可以稍后解决 The quick fix is to get the underlying text run of the cell, and ...
  • 更确切地说,.docx文档是OpenXML格式的Zip存档,您首先要解压缩它。 我下载了一个示例(Google: 一些搜索字词filetype:docx ),解压后我发现了一些文件夹。 word文件夹包含文件本身,在文件document.xml中 。 More exactly, a .docx document is a Zip archive in OpenXML format: you have first to uncompress it. I downloaded a sample (Google: ...
  • 对于这个特定的场景,我会将用户输入分开并将其作为2个部分放入查询中(如果有可能输入超过2个部分的名称,您可能需要设置一个循环来分隔用户输入)。 您最终会得到一个如下所示的查询: WHERE " & tblEmployee.FullName & " LIKE '* " & NamePt1 & " *' AND " & tblEmployee.FullName & " LIKE '* " & NamePt2 & " *'" 或者,您可能希望规范化数据库并将名称分为3个部分,因为这是标准化的数据库设计。 For ...
  • 我最后做了一个不同的方法。 由于单词查找功能导致错误,我决定编码搜索/删除。 以下代码删除它遇到的所有分节符。 private void RemoveAllSectionBreaks(Word.Document doc) { Word.Sections sections = doc.Sections; foreach (Word.Section section in sections) { section.Range.Select(); Word.Se ...
  • 表示为Flat OPC XML,它可以很简单:
    经过大量的试验和错误...函数“Range.InsertFile”实际上并不插入文件,它读取并附加文本到Range中。 解决方案很简单 - 复制粘贴... using System.Collections.Specialized; ... ... //Copy the Filename to Clipboard (setFile function uses StringCollection) StringCollection collection = new StringCollection(); coll ...
  • CLVIEW.EXE不支持命令行参数启动到某个页面。 它通常用于在托管的Office应用程序中启动您自己的自定义帮助文件。 使用Word 2007,有一些选项可用。 他们依赖,让我再说一遍,他们取决于您的帮助是在线还是离线模式。 如果您的目的只是让人们访问特定的Word帮助页面并且他们可以访问Internet,则可以在联机模式下从帮助文件中获取URL。 要执行此操作,只需右键单击要链接的页面,例如“将文本设置为粗体”页面,然后单击“属性”。 然后复制URL(地址),即http://office.micros ...
  • 你所看到的叫做VSTO( Visual Studio Tools for Office )。 这是一种创建和管理客户端即时插件,模板和文档的方法(或者像某些情况下,只是控制特定操作的客户端)。 它带来了很多开销。 听起来你想要的是Open XML SDK 2.0 。 这将完全访问创建Word(和其他Office)文档而无需Word客户端或VSTO需求(VSTO运行时,主要Interops等)的程序或在创建它们的操作系统上。 OpenXML SDK有大量的信息 - 一个好的起点是http://www.open ...
  • 删除线, POIFSFileSystem fileSystem = new POIFSFileSystem(fis); remove the line, POIFSFileSystem fileSystem = new POIFSFileSystem(fis);

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。