Interprocess communication from SQL Server Project

2019-07-11 13:28发布

问题:

I'm trying to create a SQL Server CLR user-defined function that connects to a 3rd-party service (hosted on the same server as the SQL Server instance). Is there a way to get WCF named pipes or TCP to work in this situation? Is there a better way to do this, if I provide an intermediary service?

回答1:

Don't implement IPC in SQLCLR. The SQL server hosted CLR uses SQL threading primitives and you'll end up starving the SQL worker threads and schedulers.

Do all your IPC from a process outside SQL Server. If you need to communicate with this process from SQL jobs (from stored procedures and triggers) use in-database queuing, either by Tables as Queues or by Service Broker.