How can I use my Proxy credentials when installing

2019-05-23 13:22发布

问题:

I am using an authenticated proxy to connect to the internet. The proxy settings are listed in Control Panel, and I get a user/password dialog box the first time I connect to a website.

While it normally works fine, when I launched a Clickonce application that needed to download files from the internet, I got this error:

Application download did not succeed. Check your network connection, or contact your system administrator or network service provider.

I went into the log file, and found this:

ERROR DETAILS
    Following errors were detected during this operation.
    * [22/12/2012 15:19:25] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
        - Downloading http://#######.###/########.application did not succeed.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
            at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
            at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
            at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Net.WebException
        - The remote server returned an error: (407) Proxy Authentication Required.
        - Source: System
        - Stack trace:
            at System.Net.HttpWebRequest.GetResponse()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

I've added the credentials to the "My Credentials" section in user settings, but it still did not work.

Is there any way to download files for a Clickonce application, via an authenticated proxy?

回答1:

Googling "proxy credentials in clickonce" and filtering for results within the past year I found this work-around.

How to use ClickOnce with proxy authentication: http://www.0x00.to/post/2012/12/31/How-to-use-ClickOnce-with-proxy-authentication

EDIT

https://github.com/mc-kay/ClickOnceWithProxySupport