System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http::8080

后端 未结 5 1389
终归单人心
终归单人心 2021-02-02 08:45

I have created my first self-hosted WCF service. I hosted it in a C# console app but it throws an error:

System.ServiceModel.AddressAccessDeniedException

5条回答
  •  梦毁少年i
    2021-02-02 09:08

    If you ran into this error while starting the service on Windows Service, you can check the account on your process installer.

    [RunInstaller(true)]
    public class ProjectInstaller : Installer
    {
        private ServiceProcessInstaller process;
        private ServiceInstaller service;
    
        public ProjectInstaller()
        {
            process = new ServiceProcessInstaller();
            process.Account = ServiceAccount.LocalSystem;
            service = new ServiceInstaller();
            service.ServiceName = "WCFWindowsServiceSample";
            Installers.Add(process);
            Installers.Add(service);
        }
    }
    

提交回复
热议问题