那里
运行时上下文:我用VS2012编写了一个简单的WCF控制台应用程序,在Windows上运行流畅,但是尝试在Ubuntu上通过mono运行时出现异常
单声道版本:2.10.6
例外:
未处理的异常:System.InvalidOperationException:System.ServiceModel.ServiceHostBase.BuildListener (System.ServiceModel.Description.ServiceEndpoint se, System.ServiceModel.Channels.BindingParameterCollection pl) [0x00000] in :0 at System 不支持任何侦听器通道类型.ServiceModel.ServiceHostBase.BuildChannelDispatcher (System.ServiceModel.Description.ServiceEndpoint se, System.ServiceModel.Channels.BindingParameterCollection commonParams) [0x00000] 在 System.ServiceModel.ServiceHostBase.InitializeRuntime () [0x00000] 在 System.ServiceModel.ServiceHostBase.InitializeRuntime () [0x00000] 在 System.0 中。 ServiceModel.ServiceHostBase.OnOpen (TimeSpan timeout) [0x00000] in :0 at System.ServiceModel.Channels.CommunicationObject.Open (TimeSpan timeout) [0x00000] in :0 at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000]在:0 在 DynIPServiceHost.Program。Main (System.String[] args) [0x00000] in :0
唯一的主要功能是:
static void Main(string[] args)
{
try
{
Binding binding = new NetTcpBinding();
ServiceHost sh = new ServiceHost(typeof(DynIPService.DynIPService));
sh.AddServiceEndpoint("DynIPServiceContract.IDynIPService", binding, "net.tcp://10.161.66.213:808");
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");
//Console.WriteLine("Current Uri is:);
}
catch (Exception ex)
{
Console.WriteLine("Error:" + ex.Message);
throw;
}
finally
{
Console.ReadKey();
}
}
}