WCF客户端内的SQL CLR [英] WCF Client Inside SQL CLR

查看:126
本文介绍了WCF客户端内的SQL CLR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是不支持的,我知道这甚至不是一个非常不错的主意。但是,我想有一个SQL表值函数中WCF客户端。

我有(貌似)注册了正确的组件,但运行我的客户端时 - 我得到一个WCF错误:

消息6522,级别16,状态1,行1
System.ServiceModel.CommunicationObjectFaultedException:
 通信对象,System.ServiceModel.ChannelFactory`1 [MyProxy.IMyService]
 不能用于通信,因为它是在故障状态。

的SQL Server之外的测试似乎工作 - 我甚至不看WCF客户端试图让一个TCP连接

不知道这是一个WCF或SQL CLR的问题,因为我是新来的两个.....

编辑:据我所知,所需要的System.ServiceModel和它的许许多多的组件是审核SQL CLR名单之外。然而,

  

不支持的库仍然可以从您的托管存储过程调用,触发器,用户定义的函数,用户定义类型和用户定义聚合,不支持的库必须先在SQL Server数据库中注册,使用CREATE ASSEMBLY语句,才可以在code使用。已注册并运行在服务器上的任何不支持的库进行审查和测试,安全性和可靠性。

解决方案

这篇文章可以帮助你找出真正的潜在的异常是什么,看看它是多么致命的:

http://jdconley.com/blog/archive/2007/ 8月22日/ wcfclientwrapper.aspx

由于正确大卫说,SQL CLR中具有有限的支持.NET程序集的子集:

SQL 2005支持.NET Framework库
SQL 2005 CLR集成编程模型限制

SQL Server 2008支持的.NET Framework库
SQL Server 2008 CLR集成编程模型限制

System.Web.Services支持,如果终点是一个WSDL服务,这样可以帮助你摆脱困境?或者你可以总是使用Web服务,以任何非web服务的WCF终结你试图跟一个代理服务器。

I know it's not supported, and I know it's not even a terribly good idea. But, I want to have a WCF client inside a SQL Table Valued Function.

I've (seemingly) registered the correct assemblies, but when running my client - I get a WCF error:

Msg 6522, Level 16, State 1, Line 1
System.ServiceModel.CommunicationObjectFaultedException: 
 The communication object, System.ServiceModel.ChannelFactory`1[MyProxy.IMyService], 
 cannot be used for communication because it is in the Faulted state.

A test outside of Sql Server seems to work - and I don't even see the WCF client trying to make a TCP connection.

Not sure if this is a WCF or SQL CLR issue, as I'm new to both.....

Edit: I understand that the required System.ServiceModel and it's umpteen assemblies are outside of the vetted Sql CLR list. However,

"Unsupported libraries can still be called from your managed stored procedures, triggers, user-defined functions, user-defined types, and user-defined aggregates. The unsupported library must first be registered in the SQL Server database, using the CREATE ASSEMBLY statement, before it can be used in your code. Any unsupported library that is registered and run on the server should be reviewed and tested for security and reliability."

解决方案

This article might help you find out what the true underlying exception is and to see how fatal it is:

http://jdconley.com/blog/archive/2007/08/22/wcfclientwrapper.aspx

As David correctly says, the SQL CLR has support for a limited subset of .NET assemblies:

SQL 2005 Supported .NET Framework Libraries
SQL 2005 CLR Integration Programming Model Restrictions

SQL 2008 Supported .NET Framework Libraries
SQL 2008 CLR Integration Programming Model Restrictions

System.Web.Services is supported if the end point is a WSDL service so that might help you get out of a hole? Or you could always use a web service as a proxy to whatever non-webservice WCF endpoint you're trying to talk to.

这篇关于WCF客户端内的SQL CLR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆