Home > Software engineering >  How to listening port in Office (VSTO)?
How to listening port in Office (VSTO)?

Time:02-14

I wrote a VSTO Add-In for PPT, this extension can send notes to mobile phones in the local area network through websocket service when ppt is playing.

It may be due to security reasons. Port 8080 can only be successfully monitored when ppt is started with administrator privileges. Is there any way to solve it?

System.Net.HttpListenerException:access denied.

CodePudding user response:

I think you need to re-design your communication layer in the add-in and service. Add-in is loaded by the host application and can't request admin privileges on its own. Instead, you may consider using any other communication mechanisms that don't require admin privileges. Actually, you are free to use any .net tools and technologies from the VSTO add-in because it is still a .net application. For example, see What Is Windows Communication Foundation.

CodePudding user response:

Maybe you can try granting permissions to a specific URL.

netsh http add urlacl url=http:// :80/MyUri user=DOMAIN\user

or

netsh http add urlacl url=http:// :8008/ user=Everyone listen=yes

You can check these posts to find the solution:
HttpListener Access Denied
https://stackoverflow.com/questions/14962334/httplistenerexception-access-denied-for-non-admins

  • Related