C# Windows服务平台上的WCF不支持Windows Server 2012 R2上的异常

C# Windows服务平台上的WCF不支持Windows Server 2012 R2上的异常,c#,wcf,windows-services,windows-server,C#,Wcf,Windows Services,Windows Server,我正在Windows服务中托管WCF服务。它适用于多个版本的Windows、Windows 7、Windows 8、Windows 10、Windows Server 2016 但是,在Windows Server 2012 R2中,它不起作用 当我尝试启动服务时,出现以下错误: Service can not be started. System.PlatformNotSupportedException: This platform does not support operation.

我正在Windows服务中托管WCF服务。它适用于多个版本的Windows、Windows 7、Windows 8、Windows 10、Windows Server 2016

但是,在Windows Server 2012 R2中,它不起作用

当我尝试启动服务时,出现以下错误:

Service can not be started. System.PlatformNotSupportedException: This platform does not support operation.
   at System.Net.HttpListener..ctor()
   at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
   at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
   at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
   at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelListener`1.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channe...
以下是服务代码:

using System;
using System.Configuration;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceProcess;

namespace WindowsService
{
    public partial class GerenciadorMorphoService : ServiceBase
    {
        private ServiceHost mHost = null;

        public GerenciadorMorphoService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            if (mHost != null)
            {
                mHost.Close();
            }

            Uri EndPoint = new Uri(ConfigurationManager.AppSettings["EndPointHttp"]);
            mHost = new ServiceHost(typeof(Terminais.Terminal), EndPoint);

            ServiceMetadataBehavior behave = new ServiceMetadataBehavior
            {
                HttpGetEnabled = true
            };

            mHost.Description.Behaviors.Add(behave);

            mHost.Open();
        }

        protected override void OnStop()
        {
            if (mHost != null)
            {
                mHost.Close();
                mHost = null;
            }
        }
    }
}
ConfigurationManager.AppSettings[“EndPointHttp”]中的地址为

防火墙已禁用, 没有使用端口46125的应用程序(我使用netstat命令进行了验证) 我正在使用管理员帐户

我在这里看到一些这样的帖子:

然而,任何建议的解决方案都适用于我的案例


有人知道会发生什么吗?

我在这个链接中找到了答案

http驱动程序已禁用,在windows 2012中,您只能在注册表中更改该驱动程序

HKEY\U LOCAL\U MACHINE\SYSTEM\CurrentControlSet\Services\HTTP


启动键必须是3(4被禁用)

我在这个链接中找到了答案

http驱动程序已禁用,在windows 2012中,您只能在注册表中更改该驱动程序

HKEY\U LOCAL\U MACHINE\SYSTEM\CurrentControlSet\Services\HTTP


开始键必须是3(4被禁用)

谢谢这是一个非常重要的答案!谢谢你,这是一个非同寻常的回答!