问题描述
使用Windows HTTP API我在localhost上运行HTTP文件服务器。
Using the Windows HTTP API I'm running a HTTP file server on localhost.
这包括调用 HttpAddUrl(hRequestQueue,Lhttp :// localhost:80 /,NULL)
。
这会失败, ERROR_ACCESS_DENIED
除非用户以管理员身份运行应用程序。我需要这个功能为没有管理员权限的用户。 (无论如何,运行localhost服务器的用户有什么问题?)
This fails with ERROR_ACCESS_DENIED
unless the user runs the application as administrator. I need this functionality for users who don't have admin privileges. (What's wrong with a user running a localhost server anyway? It's just for the user themselves.)
我发现了一个,这似乎旨在解决这个问题,但没有为Windows 7的任何东西。文章暗示它是在Vista SP1中固定,我有Windows 7 SP1,它仍然是一个问题 - 修复没有使它到Windows 7?
I found a hotfix for Vista and XP which seems aimed at solving this, but there's nothing for Windows 7. The article implies it was fixed in Vista SP1, and I have Windows 7 SP1 and it's still a problem - did the fix not make it to Windows 7?
还有其他我可以做的,让服务器运行非管理员?
Is there anything else I can do to get the server to run for non-admins?
推荐答案
回答自己的问题,但找到了一个解决方法:状态端口49152-65535用于动态/私有目的。 HttpAddUrl
对于端口上的localhost> = 49152对于非管理员可以正常工作。
Answering my own question, but found a workaround: the IANA port numbers state ports 49152-65535 are for dynamic/private purposes. HttpAddUrl
for localhost on a port >= 49152 works fine for non-admins.
这篇关于非管理员用户的localhost上的HttpAddUrl失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!