试图从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 (将#修改为@)