SQL CLR、HttpWebRequest 和连接限制
再会!
我继承了一个相当复杂的MSSQL数据库。代码中使用的是从存储过程中调用的 CLR 程序集 DLL。
在这些 CLR 程序集 DLL 中,我们通过来自 SQL 服务器的 .Net 2.0 HttpWebRequest 对象访问第三方 Web 服务。 (虽然我知道这不是执行此操作的适当方法,但请记住这是继承的,我们正在修复此问题。)
这是我们当前遇到的困境:
SQL CLR 当前被限制为两 (2) 个出站通信线程(由 netstat 验证)。
有没有办法增加 SQL 服务器的出站线程数,无论是通过 .Net 配置还是通过其他方法(包括更改程序集)?
已尝试的项目:
- IIS 工作线程增加
- 机器。配置:
- 流程模型调整
- httpRuntime 调整
- system.net连接管理调整
但是,无论在 .Net 配置或 IIS 中进行什么更改,我都无法增加出站线程的数量。我花了几个小时在互联网上 Google 搜索,试图找到与 HttpWebRequests、SQL CLR、程序集、权限类型以及任何可以提供帮助的内容相关的答案...
您可能需要的其他一些统计信息:
- 用 .NET 版本编写的代码2.0
- SQL Server 2008 R2 EE
- Windows Server 2008 R2、IIS 7.5
- sp_configure clr_enabled = true
- 程序集/SP 设置为 EXTERNAL_ACCESS
- SP 的构建方式为加密
预先感谢您提供的任何信息。如果您还有其他需要,请随时询问。
JR
Good day!
I have inherited a fairly complex MSSQL database. Used within the code are CLR Assembly DLLs that are called from within stored procedures.
Within these CLR Assembly DLLs, we are reaching out to a 3rd party web service via the .Net 2.0 HttpWebRequest object from the SQL server. (While I understand that this is not the appropriate way to do this, please keep in mind that this was inherited and we are in the process of fixing this.)
Here is the quandary we are currently experiencing:
The SQL CLR is currently throttled to two (2) outbound communication threads (as verified by netstat).
Is there any way to increase the number of outbound threads from the SQL server, either via the .Net configurations or by some other method, including altering the assembly?
Items attempted already:
- IIS Worker Thread increase
- Machine.Config:
- processModel tuning
- httpRuntime tuning
- system.net connectionManagement tuning
However, no matter what changes are done in the .Net configuration or in IIS, I cannot increase the number of outbound threads. I've spent hours Google'ing the internets to try to find an answer as it relates to HttpWebRequests, SQL CLR, Assemblies, permission types, anything that can help...
Some other stats you may request:
- Code written in .NET Version 2.0
- SQL Server 2008 R2 EE
- Windows Server 2008 R2, IIS 7.5
- sp_configure clr_enabled = true
- Assembly / SP set to EXTERNAL_ACCESS
- SP was built WITH ENCRYPTION
Thank you in advance for any information you might be able to provide. If you need anything else, please feel free to ask.
J.R.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是使用代码解决的,特别是:
这两行代码需要添加到 CLR 中,然后在 SQL Server 上重新构建程序集。
希望这对以后的人有所帮助。
JR
This was solved using code, specifically the:
These two lines needed to be added to the CLR and then the assembly rebuilt on the SQL server.
Hope this helps someone later on in the future.
J.R.