【问题标题】:Unable to cast object of type 'System.Guid' to type 'System.IConvertible'无法将“System.Guid”类型的对象转换为“System.IConvertible”类型
【发布时间】:2014-04-08 13:15:38
【问题描述】:

我正在尝试使用 BizTalk 2013 中的 WCF-SQL 适配器从存储过程返回记录。 我遵循了一个简单的online walkthrough,这似乎让我得到了我需要的东西。 但是,当接收位置运行时,我不断收到转换错误。我的 SP 中没有任何 GUID。我什至将我的 SP 简化为返回硬编码字符串的 SQL 语句。

SELECT [Description] , PackageName FROM ( SELECT 'ABC' [Description] ,'123' as PackageName ) as ResponseTable

Schema 需要两个字符串类型的字段。

请参阅下面的错误。

The receive location "Receive - Package" with URL "mssql://xxx/xxx?InboundId=PackageErrors" is shutting down. Details:"Microsoft.ServiceModel.Channels.Common.AdapterException: Unable to cast object of type 'System.Guid' to type 'System.IConvertible'.. Endpoint Address - mssql://xxx/xxx?InboundId=PackageErrors ---> <b>System.InvalidCastException: Unable to cast object of type 'System.Guid' to type 'System.IConvertible'.</b>
at Microsoft.Adapters.Sql.SqlAdapterInboundHandler.Polling_WaitForMessage(TimeoutHelper timeoutHelper)
at Microsoft.Adapters.Sql.SqlAdapterInboundHandler.WaitForMessage(TimeSpan timeout)
--- End of inner exception stack trace ---
at Microsoft.Adapters.Sql.SqlAdapterInboundHandler.WaitForMessage(TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.WaitForMessage(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.WaitForMessage()".

【问题讨论】:

  • 您是导入向导生成的绑定文件还是手动创建接收位置?
  • 是的,我手动导入了这个绑定文件。
  • 发现问题是我的投票语句缺少 COUNT() 部分。所以它实际上是返回错误中提到的 GUID。

标签: biztalk biztalk-2013


【解决方案1】:

这种遍历在一方面是错误的。

您最好使用“使用适配器服务”,而不是使用“添加适配器元数据”,选择 sqlBinding,配置 URI,连接,为合同类型选择服务(入站操作)并选择您的存储过程从那里开始。

这将为您的接收位置创建一个绑定文件带来额外的好处,然后您可以将其导入并正确配置。它不会像添加适配器元数据那样创建编排,但我实际上更喜欢这样做。

【讨论】:

    猜你喜欢
    • 2015-12-17
    • 2012-03-14
    • 1970-01-01
    • 1970-01-01
    • 2020-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多