简体   繁体   English

应用程序更新程序-不断收到401未经授权的错误

[英]Application Updater - Keep getting 401 Unauthorized error

Im testing out the .Net application updater component as decribed here Updater component 我按照此处描述的方法测试了.Net应用程序更新程序组件

Im getting an issue that when the client tries to access the update.xml file I am getting a 401 Unathorized access error. 我遇到一个问题,当客户端尝试访问update.xml文件时,出现了401 Unathorized访问错误。

I can see the update.xml file when I go to the url through the web browser. 通过Web浏览器访问url时,我可以看到update.xml文件。 Any ideas what Im doing wrong? 有什么想法我做错了吗?

The "server" part is just on local host. “服务器”部分仅在本地主机上。

Edit 编辑

//Retrieve the File
        HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
        Request.Headers.Add("Translate: f");
        Request.Credentials = CredentialCache.DefaultCredentials;

        //Set up the last modfied time header
        if (File.Exists(filePath)) 
            Request.IfModifiedSince = LastModFromDisk(filePath);

        try 
        {
            Response = (HttpWebResponse)Request.GetResponse();// this is where error is being thrown.
        }

Kind Regards 亲切的问候

Ash

Have you tried running your uri through fiddler? 您是否尝试过通过提琴手操作您的uri? - http://www.fiddler2.com/fiddler2/ -http://www.fiddler2.com/fiddler2/

Using this tool you can see the request and response, and potentially work out what is causing the issue more than just a 401 error. 使用此工具,您可以查看请求和响应,并可能找出导致问题的原因,而不仅仅是401错误。

Is your computer connecting to the Internet via an authenticating web proxy? 您的计算机是否通过身份验证的Web代理连接到Internet? If it is, .NET won't talk to the proxy unless the application configuration file contains a bit like this: 如果是这样,.NET将不会与代理通信,除非应用程序配置文件包含如下内容:

<system.net>
  <defaultProxy useDefaultCredentials="true"/>
</system.net>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在上传文件时出现401未经授权的错误 - Getting 401 Unauthorized error on file upload 从我的C#应用​​程序访问webDav文件夹时出现401未经授权的错误? - Getting 401 unauthorized error while accessing webDav folder from my C# application? 在多租户应用程序中的 Active Directory 用户映像中出现 401(未经授权)错误 - Getting 401 (Unauthorized) error in Active Directory user image in Multi tenant Application 在C#窗口应用程序中SSRS报告呈现中出现错误:请求失败,HTTP状态为401:未经授权 - Getting Error in SSRS report rendering in C# window application: The request failed with HTTP status 401: Unauthorized 为什么我会收到未经授权的Yahoo OAuth 2.0错误(401)? - Why i am getting Yahoo OAuth 2.0 error (401) Unauthorized? 为什么我在 Google Calendar API 中收到 (401) 未经授权的错误 - Why am I getting a (401) Unauthorized Error in Google Calendar API ServiceBus引发401未经授权的错误 - ServiceBus throws 401 Unauthorized Error HttpWebResponse 401-error未经授权 - HttpWebResponse 401-error Unauthorized GCM提供错误:(401)未经授权 - GCM giving error: (401) Unauthorized WebClient 生成 (401) 未授权错误 - WebClient generates (401) Unauthorized error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM