Clickonce troubleshooting

Troubleshooting clickonce common issues

1) Dreaded  407 error  "The remote server returned an error: (407) Proxy Authentication Required" while installing the application on the client machines

General cause of the issue is because of the usage of  the ISA proxy on the client machines , the KB  https://support.microsoft.com/?id=917952 should fix the issue, the hot fix needs to be installed on all the

client machines. If there are large number of users, create a msi and push the same through GPO

Alternative method is to edit the defaultProxy element in %windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config  on the client machine with the following xml
 <system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
   <proxy proxyaddress=”https://<ip:port>” bypassonlocal="true" usesystemdefault="false" />
   <bypasslist> <add address="[a-z]+\.domainname\.com$"/> </bypasslist>
  </defaultProxy>
 </system.net>

Example from the link https://msdn2.microsoft.com/en-us/library/kd3cf2ex(VS.80).aspx
 <configuration>
    <system.net>
   <defaultProxy>
         <proxy   usesystemdefaults="true"  proxyaddress="https://192.168.1.10:3128"   bypassonlocal="true"   />
         <bypasslist   <add address="[a-z]+\.contoso\.com" />  </bypasslist> 
   </defaultProxy>
    </system.net>
 </configuration>

****We are avoiding the usage of the proxy by the application to fix the error

Additionaly clickonce does not support Basic uthentication and only supports NTLM.
You get the errors
"The files could not be downloaded from https://<RemoteServer>/<ApplicationName>/. The remote server returned an error: (401) Unauthorized."
Cannot Retrieve Application. Authentication Error.

Refer the article for more info https://support.microsoft.com/kb/925263

------------------------------------
2) Application does not launch  when we click on the clickonce app shortcut, instead we get a dialog box to install the app( as if it were first time installation) - Do you want to install this application?

This problem occurs because the ClickOnce store initialization process acquires the wrong user profile location from the system. This action causes the store to reinitialize. Additionally, the registry loses track

of all the existing ClickOnce programs. Therefore, the programs require reinstallation.

Refer the KB https://support.microsoft.com/?id=922935 - Hot fix available

------------------------------------
3) Application does not launch using the shortcut

a) Try launching the application exe which will be located in the folder %userprofile%\Local Settings\Apps\2.0 and see if this works. If this works that means the link is broken.
b) Copy the application on to the machine, i mean the entire project and try launching the exe directly to see if it runs.
c) If the above steps do not work, Remove the appliaction using Add/Remove Programs.
d) Clear the clickonce application cache, from the location on the machine  %userprofile%\Local Settings\Apps\2.0.
e) Re-install the application

=========================================
In general troubleshooting clickonce applications

Application installation fails on clients - ***Log file has the clue

1) Usually when the installation is not successful, we get to see a error log
ClickOnce maintains activation log files for all deployments. These logs document any errors pertaining to installing and initializing a ClickOnce deployment. By default, ClickOnce creates one log file for each deployment activation. It stores these log files in the "Temporary Internet Files folder". The log file for a deployment is displayed to the user when an activation failure occurs, and the user clicks Details... in the resulting error dialog box.

To set a custom log file location instead of the "Temporary Internet Files folder", Open Regedit.exe (registry editor)
Navigate to the node HCKU\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment.
Set the string key LogFilePath to the full path of your preferred custom log location.
This location must be in a directory to which the user has write access.
HCKU\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment