从SQL CLR存储过程调用WCF服务 [英] Calling a WCF Service from SQL CLR Stored Procedure

查看:179
本文介绍了从SQL CLR存储过程调用WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个SQL CLR存储过程,该过程将调用WCF服务.我已经设法将所有正确的DLL加载到SQL Server中,以使其正常工作,但是现在出现以下错误消息:

I have created a SQL CLR Stored Procedure which will call a WCF Service. I have managed to get all the correct DLL's loaded into SQL Server to get this to work however I now have following error message:

System.Configuration.ConfigurationErrorsException:为system.serviceModel/extensions创建配置节处理程序时发生错误:无法加载文件或程序集'System.IdentityModel,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或它的依赖项之一.主机存储区中的程序集与GAC中的程序集具有不同的签名. (来自HRESULT的异常:0x80131050)(C:\ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 \ Config \ machine.config第185行) System.Configuration.ConfigurationErrorsException: 在System.Configuration.BaseConfigurationRecord.EvaluateOne处(字符串[]键,SectionInput输入,Boolean isTrusted,FactoryRecord factoryRecord,SectionRecord sectionRecord,对象parentResult) 在System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentResult,Boolean getLkg,Boolean getRuntimeObject,Object& result,Object& resultRuntimeObject) 在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey,布尔getLkg,布尔checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和结果,对象和结果RuntimeObject) 在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串configKey,布尔getLkg,布尔checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和结果,对象和结果RuntimeObject)处 在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey,布尔getLkg,布尔checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和结果,对象和结果RuntimeObject) 在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串configKey,布尔getLkg,布尔checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和结果,对象和结果RuntimeObject)处 在System.Configuration.BaseConfigurationRecord.GetSection(String ...

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for system.serviceModel/extensions: Could not load file or assembly 'System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config line 185) System.Configuration.ConfigurationErrorsException: at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String ...

我在网上找到了该帖子,但是我不知道如何更新GAC或它实际上是否是问题的解决方法:(

I found this posting on the web but I don't know how to update the GAC or whether its actually the fix for the problem: (Invoking a WCF Service from a CLR Trigger)

推荐答案

查看Niels Berglund的博客文章:> ://nielsb.wordpress.com/sqlclrwcf/您可以从machine.config文件中删除有问题的行,或者使用vsdiag_regwcf.exe -u在计算机上禁用WCF的调试.更改.config文件后,您将必须回收SQL,以便重新启动应用程序域.

Look at Niels Berglund's blog post: http://nielsb.wordpress.com/sqlclrwcf/ You can remove the offending line from the machine.config file, or disable the debugging of WCF on the machine with vsdiag_regwcf.exe -u. You will have to recycle SQL once you make the .config file change so that it rejits the app domains.

这篇关于从SQL CLR存储过程调用WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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