wpf WCF 服务在没有管理员权限的情况下无法运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12529818/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WCF Service not running without Administrator rights
提问by Vibhore Tanwer
I am new to WCF. I have a WCF service which I am hosting in a WPF application, while running the service it requires admin rights. Every time I have to right click the application which host my service and select "Run As Administrator". How can I make the service run on Windows 7?
我是 WCF 的新手。我有一个 WCF 服务,我在 WPF 应用程序中托管它,运行该服务时它需要管理员权限。每次我必须右键单击托管我的服务的应用程序并选择“以管理员身份运行”时。如何使该服务在 Windows 7 上运行?
回答by Vibhore Tanwer
I could not get what exactly my question was asking, but I got a workaround. Admin rights are needed only if you are using http bindings with WCF. I switched to netTcpBinding and it worked for me. It's not exactly what I asked, but worked for me. Maybe it will help someone facing similar issues.
我不知道我的问题到底在问什么,但我有一个解决方法。仅当您在 WCF 中使用 http 绑定时才需要管理员权限。我切换到 netTcpBinding,它对我有用。这不完全是我所要求的,但对我有用。也许它会帮助面临类似问题的人。
回答by flayn
Try using a higher port. Low ports may only be opend with administrative rights.
尝试使用更高的端口。低端口只能以管理权限打开。
You might also have to use NETSH:
您可能还必须使用 NETSH:
In cmd promt enter:
在 cmd 提示符下输入:
NETSH
add urlacl url=http://+:8732/ user=DOMAIN\user
网易
添加 urlacl url=http://+:8732/ user=DOMAIN\user

