How ordinary users start a WCF service

Source: Internet
Author: User

When doing a WinForm project, there are two applications, host, and client deployed to the client, running a WCF service on host for client invocation. There is no problem at the time of the test, but when installing to the customer's formal environment, the service startup failure is discovered. Such as

It is obvious that this is due to the absence of administrator privileges. So does the WCF service have to be open under administrator privileges? Consulted the relevant information, found the following solutions.

     Public Static classNetaclchecker { Public Static voidAddurlacltoeveryone (intPort) {            stringargs =string. Format (@"http Add urlacl url=http://+:{0}/user=everyone", Port); varPSI =NewProcessStartInfo ("Netsh", args); Psi. Verb="runas"; Psi. CreateNoWindow=true; Psi. WindowStyle=Processwindowstyle.hidden; Psi. UseShellExecute=true; Process.Start (PSI).        WaitForExit (); }    }
class program    {        staticvoid Main (string[] args)        {            int 9090 ;            Netaclchecker.addurlacltoeveryone (port);        }    }

Run the above program under administrator privileges, the 9090 port has been successfully added to the listening list, and then the normal user rights can be successful to open the WCF service.

How ordinary users start a WCF service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.