如何解决试图从NServiceBus消息处理程序内部调用WCF服务,但在创建服务客户端时挂起
| 在这里一定做错了什么。这是我想要做的。 我有一个消息处理程序,应该从队列中获取消息。进行WCF呼叫,执行操作,完成后在总线上发送新消息。 它托管在NServiceBus.Host.Exe中。 但是,每当我创建Service Client时,艰辛的工作都会停止。如果我将服务呼叫注释掉,那么一切都会很好...除了,我需要该呼叫。 将消息托管在NServiceBus.Host.Exe中时,有什么技巧可以使我的消息处理程序进行WCF调用?我没有在EndPointConfig类中进行任何特殊的配置。 public class EndpointConfig :
IConfigureThisEndpoint,AsA_Server { }
public class RequestAccountUpdateMessageHandler : IHandleMessages<RequestAccountUpdateMessage>
{
public void Handle(RequestAccountUpdateMessage message)
{
// The Line below hangs everything
AccountService.AccountServiceClient client =
new AccountService.AccountServiceClient();
resp = client.DoStuff(message.parameter);
Bus.Send<UpdateAccountMessage>(m =>
{
m.info = DoMagicStuffHere(resp);
});
}
...
}
这就是system.serviceModel在App.Config中的样子
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name=\"BasicHttpBinding_IAccountService\" closeTimeout=\"00:01:00\" openTimeout=\"00:01:00\" receiveTimeout=\"00:01:00\" sendTimeout=\"00:01:00\" allowCookies=\"false\" bypassProxyOnLocal=\"false\" hostNameComparisonMode=\"StrongWildcard\" maxBufferSize=\"65536\" maxBufferPoolSize=\"524288\" maxReceivedMessageSize=\"65536\" messageEncoding=\"Text\" textEncoding=\"utf-8\" transferMode=\"Buffered\" useDefaultWebProxy=\"false\">
<readerQuotas maxDepth=\"32\" maxStringContentLength=\"8192\" maxArrayLength=\"16384\" maxBytesPerRead=\"4096\" maxNameTableCharCount=\"16384\"/>
<security mode=\"None\">
<transport clientCredentialType=\"None\" proxyCredentialType=\"None\" realm=\"\"/>
<message clientCredentialType=\"UserName\" algorithmSuite=\"Default\"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address=\"http://yadayafa/accountservice.svc\" binding=\"basicHttpBinding\" bindingConfiguration=\"BasicHttpBinding_IAccountService\" contract=\"AccountService.IAccountService\" name=\"BasicHttpBinding_IAccountService\"/>
</client>
</system.serviceModel>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。