WCF错误及处理记录

1. 错误信息:{"HTTP 无法注册 URL http://+/Temporary_Listen_Addresses/a4db1461-55c6-4ce5-be25-f41b88877434/,因为另一应用程序正在使用 TCP 端口 80。"}

    产生的环境:使用双工协定的时候。调用客户端的回调方法。

    解决方法:第一种就是将客户端的80端口的服务修改为别的端口。

                  第二种就是在客户端的代码中设置ClientBaseAddress地址,

                     代码如下:

代码
DumplexService.IDuplexSampleCallback clent = new ClientCallback();

                DumplexService.DuplexSampleClient duplexClient 
= new WebTest.DumplexService.DuplexSampleClient(new System.ServiceModel.InstanceContext(clent));

                WSDualHttpBinding ws 
= (WSDualHttpBinding)duplexClient.Endpoint.Binding;
                ws.ClientBaseAddress 
= new Uri("http://localhost:8212/");

                第三种,在配置文件中设置

代码
<wsDualHttpBinding >
                
<binding name="MyWCFStudy.MyDuplexSet" clientBaseAddress=http://localhost:8212/>
                    
<security mode="Message"></security>
                
</binding>
            
</wsDualHttpBinding>

 2.错误信息:此操作将死锁,因为在当前邮件完成处理以前无法收到答复。如果要允许无序的邮件处理,则在 ServiceBehaviorAttribute 上指定可重输入的或多个    ConcurrencyMode

   产生的环境:双工协定中。

   解决方法:在服务端实现契约的类指定ServiceBehaviorAttribute的ConcurrencyMode为Multiple。

                 在该类名上增加[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]即可。

 

posted @ 2009-12-16 17:56  独孤求败  阅读(1395)  评论(0编辑  收藏  举报