根据本教程 ,自托管的ASP.NET Web API应用程序必须以管理员身份运行,或者某人必须在将运行该应用程序的计算机上运行netsh http add urlacl命令。
我有一个控制台ASP.NET Web API应用程序,我希望部署过程尽可能简单。 有没有办法设置应用程序,以便可以部署xcopy?
According to this tutorial a self-hosted ASP.NET Web API application must be run as an administrator or someone must run the netsh http add urlacl command on the machine that will run the application.
I have a console ASP.NET Web API application and I want the deployment procedure to be as simple as possible. Is there a way to set up the application so it can be xcopy deployed?
最满意答案
这是Windows UAC限制。 如果您的应用程序需要侦听特定端口,则需要一些特权。 除非您以管理员身份运行应用程序,否则您必须运行netsh以授予运行应用程序的Windows帐户的权限以打开该端口。 您可以向控制台应用程序添加清单,以强制它始终以管理员身份运行。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator"></requestedExecutionLevel> </requestedPrivileges> </security> </trustInfo> </assembly>问候 巴勃罗。
It's a Windows UAC restriction. Some privileges are required if your application needs to listen on a specific port. Unless you run the application as administrator, you will have to run netsh to give permissions to the windows account running the app to open the port. You can add a manifest to the console application to force it to run as administrator always.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator"></requestedExecutionLevel> </requestedPrivileges> </security> </trustInfo> </assembly>Regards Pablo.
更多推荐
程序,application,应用,Web,电脑培训,计算机培训,IT培训"/> <meta name="descrip
发布评论