Unable to cast object of type 'System.Guid' to type 'System.IConvertible'

ぐ巨炮叔叔 提交于 2019-12-25 00:39:27

问题


I'm trying to use the WCF-SQL adaptor in BizTalk 2013 to return records from a stored procedure. I followed a simple online walkthrough that seemed to get me what I need. However I keep getting a casting error when the Receive Location runs. I dont have any GUID's in my SP. I have even simplified my SP to a SQL statement returning hard coded strings.

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

the Schema expects two fields of type string.

See error below.

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()".

回答1:


That walk through is wrong in one aspect.

Rather than using the "Add Adapter Metadata" you would be better of using the "Consume Adapter Service", select the sqlBinding, Configure the URI, Connect, select Service (Inbound operations) for the contract type and select your stored procedure from there.

This will have the added benefits creating a binding file for your receive location, which you can then import and will be correctly configured. It doesn't create an Orchestration like the Add Adapter Metadata, but I actually prefer that.



来源:https://stackoverflow.com/questions/22938224/unable-to-cast-object-of-type-system-guid-to-type-system-iconvertible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!