通过Mono在Ubuntu上运行WCF服务时出现异常

时间:2012-11-30 08:11:24

标签: wcf exception mono

运行时上下文:我在VS2012上编写了一个简单的WCF控制台应用程序,在Windows上运行顺利,但尝试通过单声道在Ubuntu上运行时发生异常

单声道版:2.10.6

例外:

未处理的异常:System.InvalidOperationException:不支持任何侦听器通道类型   在System.ServiceModel.ServiceHostBase.BuildListener(System.ServiceModel.Description.ServiceEndpoint se,System.ServiceModel.Channels.BindingParameterCollection pl)[0x00000] in:0   在System.ServiceModel.ServiceHostBase.BuildChannelDispatcher(System.ServiceModel.Description.ServiceEndpoint se,System.ServiceModel.Channels.BindingParameterCollection commonParams)[0x00000] in:0   在System.ServiceModel.ServiceHostBase.InitializeRuntime()[0x00000] in:0   在System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)[0x00000] in:0   在System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)[0x00000] in:0   在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();
        }
    }
}

0 个答案:

没有答案