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

后端 未结 5 1387
终归单人心
终归单人心 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条回答
  •  走了就别回头了
    2021-02-02 09:06

    I ran into the same problem on a different project.

    The problem is that binding to a tcp port requires administrative privileges. There's a couple ways to deal with this.

    1. Keep an administrative command prompt open. Then you can just run the console app directly.

    2. (As you suggested) run VS as admin. This is absolutely necessary only when debugging your app.

    3. Create an application manifiest file, specifying requestedExecutionLevel level="requireAdministrator". See How do I force my .NET application to run as administrator? for more details.

提交回复
热议问题