使用 BizTalk 使用 WCF 终结点时,什么会导致对象引用错误?
我在 BizTalk 2009 集成的另一边,我有一个相当简单的合同,看起来像这样:
[ServiceContract(Name = "ReceiverService", Namespace = "http://services.company.org/")]
public interface IReceiverService : ILoadBalanced
{
[OperationContract]
void FinishedRouting(long applicationId);
[OperationContract]
void ResponsePending(long applicationId, string stringId, short count);
[OperationContract]
void ReportException(long applicationId, string errorMessage, string stringId);
[OperationContract]
void SaveResponse(WebResponseDto decision);
}
但是,当 BizTalk 组尝试使用 WCF 服务使用向导时,它会阻塞并提供此堆栈跟踪:
[5096] System.NullReferenceException: Object reference not set to an instance of an object.
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Exporters.BindingInfoExporter.CreatePrimaryTransport(ServiceEndpoint serviceEndpoint, Boolean custom)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Exporters.BindingInfoExporter.CreateSendPort(ServiceEndpoint endpoint, Port port, Boolean custom)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Exporters.BindingInfoExporter.Export(ServiceEndpointCollection endpoints, ServiceDescriptionCollection wsdlDocuments, Boolean custom)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Consumer.CreateBindingFiles(MetadataSet metadataSet, String serviceName)
然后再这里:
[5096] System.NullReferenceException: Object reference not set to an instance of an object.
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Implementation.ClientImplementation.AddFilesToProject(String schemaNamespace)
[5096] System.NullReferenceException: Object reference not set to an instance of an object.
[5096] at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
[5096] at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Consumer.Consume(ISynchronizeInvoke synchronizeInvoke, DTE dte, MetadataSet metadataSet, Project project, String importNamespace)
有人知道从哪里开始看这个吗?
I'm on the other side of a BizTalk 2009 integration, and I have a fairly simple contract stood up that looks something like this:
[ServiceContract(Name = "ReceiverService", Namespace = "http://services.company.org/")]
public interface IReceiverService : ILoadBalanced
{
[OperationContract]
void FinishedRouting(long applicationId);
[OperationContract]
void ResponsePending(long applicationId, string stringId, short count);
[OperationContract]
void ReportException(long applicationId, string errorMessage, string stringId);
[OperationContract]
void SaveResponse(WebResponseDto decision);
}
However, when the BizTalk group attempts to use the WCF Service Consuming Wizard, it chokes and provides this stack trace:
[5096] System.NullReferenceException: Object reference not set to an instance of an object.
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Exporters.BindingInfoExporter.CreatePrimaryTransport(ServiceEndpoint serviceEndpoint, Boolean custom)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Exporters.BindingInfoExporter.CreateSendPort(ServiceEndpoint endpoint, Port port, Boolean custom)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Exporters.BindingInfoExporter.Export(ServiceEndpointCollection endpoints, ServiceDescriptionCollection wsdlDocuments, Boolean custom)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Consumer.CreateBindingFiles(MetadataSet metadataSet, String serviceName)
And then again here:
[5096] System.NullReferenceException: Object reference not set to an instance of an object.
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Implementation.ClientImplementation.AddFilesToProject(String schemaNamespace)
[5096] System.NullReferenceException: Object reference not set to an instance of an object.
[5096] at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
[5096] at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
[5096] at Microsoft.BizTalk.Adapter.Wcf.Consuming.Consumer.Consume(ISynchronizeInvoke synchronizeInvoke, DTE dte, MetadataSet metadataSet, Project project, String importNamespace)
Anyone know where to start looking on this one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WCF 客户端应用程序无法使用具有单向操作的服务协定将消息发送到 WCF 接收位置。客户端合约上的操作应标注 IsOneWay=false 和 ReplyAction=”*”。唯一的例外是当您使用 NetMsmqBinding 时,在这种情况下,客户端合约上的所有操作都应该是单向的。
WCF client applications cannot use service contracts with one-way operations to send messages to your WCF receive locations. The operations on the client-side contract should be annotated with IsOneWay=false and ReplyAction=”*”. The only exception is when you’re using NetMsmqBinding, in which case all operations on the client contract should be one-way.
它可能类似于这些 - 此处和此处,即:
您能否确认您可以在一个简单的 WCF 服务上使用 WCF 使用向导(没有基本接口、一个操作、字符串输入)并返回字符串)?如果没有,则可能是您的 VS IDE 已损坏。
FWIW void 返回似乎不是问题 - BTS 为 void 操作创建以下响应模式
并将 Contract 和 Base Contract 接口放在不同的命名空间中也可以。
但是,向 DTO/实体添加不可序列化属性失败了 svcutil 和 BizTalk WCF 向导
HTH
It might be similar to these - here and here, viz:
Can you confirm that you can use the WCF Consume Wizard on a trivial WCF service (no base interface, one Operation, string input and string return)? If not, it may be that your VS IDE is corrupt.
FWIW the void returns don't seem to be an issue - BTS creates the following response schema for void operations
And placing the Contract and Base Contract interfaces in different namespaces was also OK.
However adding a non-serializable property to the DTO / entity failed both svcutil and the BizTalk WCF Wizard
HTH