vs2010中开发站点,但更改为本地IIS和提示 [英] developing site in vs2010 but changed to local IIS and prompts

查看:136
本文介绍了vs2010中开发站点,但更改为本地IIS和提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在项目设置中使用使用Visual Studio开发服务器"运行2010 Visual Studio C#Web项目,则我的应用程序可以正常打开,并且CSS渲染和所有图像都可以渲染.

If I run a 2010 visual studio C# web project using the "Use Visual Studio Development Server" in the project settings my app opens up fine and the CSS renders and all images render.

如果我更改项目的属性以使用本地IIS Web服务器,则尝试运行该项目. 我收到有关已链接的图像/css文件的提示几乎与之差不多.如果我继续单击取消",则会显示该网页,但所有图像均丢失并且css文件未呈现(格式看起来像地狱).

If I change the property of the project to use the Local IIS Web Server and I try to run the project. I get a prompt almost about as many for how many images / css files I have linked. If i keep clicking cancel the web page appears but all the images are missing and the css file is not rendered (formatting looks like hell).

我认为好吧,这应该是某种安全问题.我在Web配置文件中设置了项目设置,以使用"Windows"身份验证,并且还启用了匿名访问.我已经添加了网络/网络服务帐户并赋予了全部权利.我已经在本地计算机上添加了ASPNET帐户,并具有完全访问权限.我什至添加了我的用户域,甚至使自己陷入了绝望,无法向他们授予完全访问权限...

I thought ok this ought to be some sort of security issue. I have the project setup in the web config file to use "Windows" authentication and I also have enabled anonymous access. I've added the network / network service account and gave full rights. I've added the ASPNET account on my local machine and gave full access. I've even added my domain of users and even got so desperate as to give them full access...

没有运气..我仍然收到提示,如果我尝试直接在URL中浏览到其中一张图像: http://localhost/mysite/images/myimage.jpg 我收到错误消息:

no luck..I still get prompted, and If I try to browse to one of the images directly in the url: http://localhost/mysite/images/myimage.jpg I get the error:

访问被拒绝.说明:访问 满足此请求所需的资源.你可能没有 查看所需资源的权限.

Access is denied. Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.

错误消息401.3:您无权查看此目录 或使用您提供的凭据的页面(由于访问被拒绝 访问控制列表).

Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists).

我不知道该怎么做才能使它正常工作....

I don't know what else to do or change to get this to work....

推荐答案

您看到的错误消息(错误消息401.3:您无权使用您提供的凭据查看此目录或页面(由于Access而导致的访问被拒绝)控制列表))通常是因为执行Web应用程序的应用程序池用户不具有对所请求的CSS和图像文件的NTFS读取权限.

The error message you are seeing (Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists)) usually occurs because the Application Pool user that executes the web application does not have NTFS Read permissions to the css and image files that are being requested.

一个Web应用程序在一个分配了用户的应用程序池下运行.您可以通过检查站点的基本设置"来找出您的应用程序正在使用哪个应用程序池.

A web application runs under an Application Pool, which has a user assigned to it. You can find out which Application Pool your application is using by checking Basic Settings for the site.

一旦知道了正在使用的应用程序池,就可以通过检查应用程序池,配置应用程序池的高级设置,然后查看高级设置->流程模型->身份,查看配置为运行该应用程序池的用户.

Once you know what Application Pool you are using, you can view which user is configured to run that Application Pool by checking Application Pools, select Advanced Settings for your app pool, then look at Advanced Settings -> Process Model -> Identity.

默认情况下,应用程序池设置为使用AppPoolIdentity用户(顺便说一句,如果您需要它,该用户的用户名是IIS APPPOOL\ApplicationPoolName,因此在我的情况下将是IIS APPPOOL\mywebapp).该用户是Users组和Authenticated Users组的成员. 如果将您的应用程序池配置为使用AppPoolIdentity用户,解决您遇到的权限问题的最简单方法是确保用户"组至少 具有阅读&执行列出文件夹内容读取访问该应用程序的Web根文件夹以及所有文件和子目录.在我的测试计算机上,除完全控制之外,已验证的用户"还具有所有访问权限. (注意:为了正确起见,每当我在C:下创建一个新文件夹时,都会应用这些ACL.如果愿意,您可以不用添加Authenticated Users或仅为Users指定读取"访问权限就可以使用.不会尝试确定所需的实际最小访问权限是什么.

By default, Application Pools are set to use the AppPoolIdentity user (incidentally, in case you need it, the username for this user is IIS APPPOOL\ApplicationPoolName, so in my case it would be IIS APPPOOL\mywebapp). This user is a member of both the Users group and the Authenticated Users group. If your Application Pool is configured to use the AppPoolIdentity user, the easiest way to resolve the permissions issue you are having is to make sure that the Users group at least has Read & Execute, List folder contents, and Read access to the web root folder for the application, along with all files and subdirectories. On my test machine, Authenticated Users also has all access allowed, with the exception of Full Control. (Note: in the interest of correctness, these ACLs are applied whenever I create a new folder under C:. If you want to, you might be able to get away without adding Authenticated Users or just specifying Read access for Users. I'm not going to try to determine what the actual minimum access required is here).

要指定这些权限,请在Windows资源管理器中右键单击包含Web应用程序的文件夹,转到属性">安全性",单击编辑",然后使用添加"添加组.请注意,添加组后,可能需要单击高级"按钮>更改权限">选中替换所有子对象权限..."按钮,然后单击确定"以授予文件夹中所有子对象的权限(请参阅以下).完成此操作后,您可以检查一个.css文件,以确保已正确添加组.

To specify these permissions, right click on the folder than contains the web application in Windows Explorer, go to Properties > Security, click Edit, and then use Add to add the groups. Note that after you add the groups, you will probably need to click the Advanced button > Change Permissions > check the "Replace all child object permissions ..." button and then click OK to grant permissions to all child objects in the folder (see below). After you complete this operation, you can check one of the .css files to make sure the groups have been added properly.

一旦添加了这些权限,IIS就应该能够提供CSS和图像文件.

Once those permissions have been added, IIS should be able to serve up the css and image files.

作为一个旁注,如果您收到Windows登录提示,则很可能已在Web应用程序的IIS的身份验证"部分下启用了"Windows身份验证-401质询".如果未指定该设置,则在尝试查看没有适当ACL的文件时将不会出现提示.相反,您只会收到错误消息.提示将不会显示.

As a side note, if you are getting a Windows login prompt, then you most likely have "Windows Authentication - 401 Challenge" enabled under the Authentication section in IIS for your web application (see below). If you do not have that setting specified, then you will not get a prompt when attempting to view a file that does not have proper ACLs. Instead, you will just get the error message. The prompt will not be shown.

我使用Windows 7 Ultimate和IIS 7.5验证了此信息,因此,如果您使用的是其他操作系统YMMV,但我认为IIS的行为应与描述的相同.

I verified this information using Windows 7 Ultimate and IIS 7.5, so if you are using a different OS YMMV, but I believe IIS should behave as described.

希望有帮助.如果您有任何疑问,请告诉我.

Hope that helps. If you have any questions please let me know.

这篇关于vs2010中开发站点,但更改为本地IIS和提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆