简体   繁体   English

从SQL CLR存储过程调用WCF服务

[英]Calling a WCF Service from SQL CLR Stored Procedure

I have created a SQL CLR Stored Procedure which will call a WCF Service. 我创建了一个SQL CLR存储过程,该过程将调用WCF服务。 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: 我设法将所有正确的DLL加载到SQL Server中,以使其正常工作,但是现在出现以下错误消息:

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. System.Configuration.ConfigurationErrorsException:为system.serviceModel / extensions创建配置节处理程序时发生错误:无法加载文件或程序集'System.IdentityModel,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其中之一依赖。 Assembly in host store has a different signature than assembly in GAC. 主机存储区中的程序集与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, Ob (来自HRESULT的异常:0x80131050)(C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v2.0.50727 \\ Config \\ machine.config第185行)System.Configuration.ConfigurationErrorsException:位于System.Configuration.BaseConfigurationRecord.EvaluateOne(String []键,System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentResult,Boolean getLkg,Boolean getRuntimeObject,Object&结果,Object&resultRuntimeObject)处的SectionInput输入,Boolean isTrusted,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentResult) .BaseConfigurationRecord.GetSectionRecursive(String configKey,布尔值getLkg,布尔值checkPermission,布尔值getRuntimeObject,布尔requestIsHere,Object&结果,Object&resultRuntimeObject)在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey,布尔值getLkg,布尔值checkPermission,布尔值getRuntimeObject,布尔值对象与结果,Ob ject& 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 ... System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey,Boolean getLkg,Boolean checkPermission,Boolean getRuntimeObject,Boolean requestIsHere,Object&result,Object&resultRuntimeObject)在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey,Boolean getLkg,Boolean checkPermission)中的ject&resultRuntimeObject) ,Boolean getRuntimeObject,布尔requestIsHere,Object&result,Object&resultRuntimeObject)位于System.Configuration.BaseConfigurationRecord.GetSection(String ...

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 ) 我在网上找到了该帖子,但是我不知道如何更新GAC或它是否真正解决了该问题:( 从CLR触发器调用WCF服务

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. 查看Niels Berglund的博客文章: http : //nielsb.wordpress.com/sqlclrwcf/您可以从machine.config文件中删除有问题的行,或者使用vsdiag_regwcf.exe -u在计算机上禁用WCF的调试。 You will have to recycle SQL once you make the .config file change so that it rejits the app domains. 更改.config文件后,您将必须回收SQL,以便重新启动应用程序域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM