运行时上下文:是一个WCF服务,它使用由Mono在Linux上运行的WSDualHttpBinding。我使用app.config,创建一个使用EndPoint的WSDualHttpBinding
app.config用于服务(部分)
<endpoint address="http://192.168.0.101:8889"
binding="wsDualHttpBinding" bindingConfiguration="wsDualHttp_Binding"
contract="DynIPServiceContract.IDynIPService" />服务代码:
static void Main(string[] args)
{
try
{
ServiceHost sh = new ServiceHost(typeof(DynIPService.DynIPService));
sh.Open();
foreach (var ep in sh.Description.Endpoints)
{
Console.WriteLine("Address: {0}, ListenUri: {1}, ListenUriMode: {2} ", ep.Address, ep.ListenUri, ep.ListenUriMode);
}
Console.WriteLine("Service is running");
}
catch (Exception ex)
{
Console.WriteLine("Error:" + ex.Message);
throw;
}
finally
{
Console.ReadKey();
}
}例外:属性'textEncoding‘的默认值与属性本身的类型不同:预期的System.Text.Encoding但为System.String (关于详细信息,请查看异常的快照)

发布于 2012-12-04 19:02:48
嗯,我只是快速地看了一下代码,这个异常实际上应该是您的问题中最小的;-)
真正的问题是在Mono中还不支持WSDualHttpBinding。
CreateBindingElements()是System.ServiceModel.Channels.Binding中一种重要的抽象方法,必须通过绑定来实现。
mcs/class/System.ServiceModel/System.ServiceModel/WSDualHttpBinding.cs上一次被修改是在2008年,它只是简单地抛出一个NotImplementedException
我必须承认,我以前也没有在Windows上使用过WSDualHttpBinding,所以我不知道它使用的是哪些绑定元素(以及它们是否已经在Mono中实现)。这些绑定元素提供了核心功能,因此很难确定实现这个绑定需要多长时间。
https://stackoverflow.com/questions/13694715
复制相似问题