WCF Application Starting Server

dwains

Member
Joined
Feb 23, 2016
Messages
14
Programming Experience
3-5
Hi all
I have downloaded this code from here
http://www.vbdotnetforums.com/windo...ed-console-server-test-client.html#post178828
I am using it pass a screen shot from an external screen got it all set works great. However I compile the code and start it as an external program because it runs better that way and doesn't take any resources from my other application.
My other application starts it using Process.start(myWCFapp.exe) when my app starts the WCF app it shows a screen asking Do you want to allow this app from an unkown publisher to make changes to your computer. I don't want to disable the UAC to avoid the message and if I don't select yes in a timely manner it errors out the program and closes my app. I don't want to purchase a certificate to bypass.
There must be a way to bypass this screen I built the external app as stated above how can I get around this.
Any help would be greatly appreciated.
Thanks Dwain
 

dwains

Member
Joined
Feb 23, 2016
Messages
14
Programming Experience
3-5
Did some searching and found that if I added a app.manifest file and changed the following code forced me to run visual studio as administrator which stopped it during debugging only. But that didn't quite solve the actual problem.
HTML:
<!-- UAC Manifest Options
             If you want to change the Windows User Account Control level replace the 
             requestedExecutionLevel node with one of the following.        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />            Specifying requestedExecutionLevel element will disable file and registry virtualization. 
            Remove this element if your application requires this virtualization for backwards
            compatibility.
        -->
          Change the following line from "asinvoker" To "requireAdministrator"
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,464
Location
Norway
Programming Experience
10+
I don't think you can bypass the screen without disable UAC notification, but you can use a self-signed certificate to replace 'unknown publisher' with your own name. If you for example run VS as admin the same confirmation comes up... In project properties you can use the signing page to generate a developer certificate (or use other tool like OpenSSL), in this page you can also click More Details and install the certificate, make sure to install it to 'trusted root certification authorities' store. Then in signing page the 'sign the assembly' is a bit misleading, this is for strong-name assemblies. You need to use SignTool from Developer Command Prompt to sign the file, see Using SignTool to Sign a File (Windows)
Now when you run the exe as admin the confirmation comes up, but with your publisher name.

As you found out, you should add application manifest to the project (Add New Item > Application manifest file), and change requestedExecutionLevel to requireAdministrator. This will automatically request admin elevation without need to right-click and 'run as admin'. As a consequence the project can not be published with ClickOnce, these settings don't go together.
 
Top Bottom