Asp.net 图像随机给出 401 未经授权的错误
我使用 Asp.net、IIS 6 和 cdn 来提供图像。 我在加载网站中的图像时遇到问题。图像位于虚拟文件夹下。每次刷新浏览器时,某些图像都会出现 401 未经授权的错误。 (每次刷新时出现 401 错误的图像和显示的图像数量都会有所不同。) 我很难解决这个问题。任何帮助都会受到热烈欢迎。
亲切的问候。
PS:我还使用负载均衡器在两台服务器之间分配流量。其中一台服务器具有实际文件和它们的虚拟文件夹。另一台服务器有虚拟文件夹,显示有文件的服务器的路径和 IP。我尝试通过每个服务器使用网站,但它们都有相同的问题。
这是标题;
响应:
HTTP/1.1 401 Unauthorized
Content-Length: 1608
Content-Type: text/html
Server: Microsoft-IIS/6.0
Date: Thu, 28 Apr 2011 14:38:55 GMT
请求
GET /img/blog/2011%2f4%2f4.png HTTP/1.1
Host: cdn.***.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16 ( .NET CLR 3.5.30729)
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.***.com/Blog
I am using Asp.net, IIS 6 and cdn for serving images.
I am having a problem with loading the images in my website. images are under a virtual folder. Everytime I hit refresh of the browser, some of the images gives 401 unauthorized error. (images and number of images displayed which gives 401 error differs in every refresh.)
I am having hard time to solve this problem. Any help will be welcomed a lot.
Kind Regards.
PS: I am also using a load balancer to distribute traffic among two servers. One of the servers has actual files and a virtual folder for them. The other server has virtual folder which shows the path and ip of the server which has files. I tried using website via each server but they both have the same problem.
Here are the headers;
Response:
HTTP/1.1 401 Unauthorized
Content-Length: 1608
Content-Type: text/html
Server: Microsoft-IIS/6.0
Date: Thu, 28 Apr 2011 14:38:55 GMT
Request
GET /img/blog/2011%2f4%2f4.png HTTP/1.1
Host: cdn.***.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16 ( .NET CLR 3.5.30729)
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.***.com/Blog
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
添加以下用户的权限到该虚拟镜像文件夹
添加上述权限后,请检查401错误是否仍然存在?
Add permission for following users to that virtual image folder
After adding the above permission please check whether 401 error is still there or not?
请将站点图像文件夹的安全权限设置为iis_user或所有人,并授予其完整权限,此错误将永久解决。
在我的一个网站上尝试这个,我遇到了同样的问题,通过使用这种方式我解决了这个错误......
please set the security permission of your site images folder to iis_user or everyone and give its full rights and this error resolved forever.
Try this in my one site i got same problem and by using this way i resolved this error....
如果问题图像随着每次刷新而变化,则可能不是权限问题 - 听起来像是正在进行某种锁定。您是否已打开索引服务或正在运行 AV 解决方案?
If the problem images change with each refresh, it's probably not a permissions issue - sounds instead like there is some kind of locking going on. Do you have the indexing service turned on, or an AV solution running?
您调查过 IIS 日志吗?几乎 100% 确定,这与虚拟文件夹的访问级别有关,并且您在打开目标位置时可能需要设置特殊凭据。
如何启用 IIS 6 日志记录? 此处。
如何分析IIS日志? 此处。
Have you investigate IIS logs? This is, almost 100% sure, related with the access level the virtual folder and you may need to set special credentials when opening the target location.
How to enable IIS 6 logging? Here.
How to analyze IIS logs? Here.
确保 MIME 类型适用于您在 IIS 中配置的图像扩展。
Make sure the mime-types are for the extensions you use of images are configures in your IIS.